How Do You Concatenate Two Values With A Space In Between?
I am trying to concatenate two strings with a space in between as follows: if(searchSymbol.toLowerCase().contains(mSearchView.getText().toString().toLowerCase()) + 'HERE COMES THE
Solution 1:
Your if statement is a little confusing to read
I would change it to
String text = string1 + " " + string2;
if(text.equals("string3")){
}
""
is not a space but " "
is a space
Solution 2:
If its used a lot in your class, just declare a final String SPACE = " ";
and use it in the code when required.
private final String SPACE = " ";
String spaceString = "String1" + SPACE + "String2";
Post a Comment for "How Do You Concatenate Two Values With A Space In Between?"