How can I find whitespace in a String?

后端 未结 14 1035
感动是毒
感动是毒 2020-12-01 05:08

How can I check to see if a String contains a whitespace character, an empty space or \" \". If possible, please provide a Java example.

For example: String

14条回答
  •  萌比男神i
    2020-12-01 05:44

    You can basically do this

    if(s.charAt(i)==32){
       return true;
    }
    

    You must write boolean method.Whitespace char is 32.

提交回复
热议问题