I have a variable that\'s a string and I want to replace the string with \"null\" if the variable contains only a space or multiple spaces. How can I do it?
Suppose your variable is String var
String var
Then,
if(var.replace(" ", "").equals("")) { var = null; }