I need the program to return a message if the user input a string with blank spaces. for example "this is my house" is not allowed, "thisismyhouse" is allowed. right now I use this code to check for blank spaces
for(int i = 0; i < blabla.length(); i++) {
if (blabla.charAt(i) == ' ')
flag++;
}
}
if (flag != 0) {
System.out.println("input must not contain spaces");
}
I wonder if there's a built in function like 'blabla.equals' etc for this purpose? or a better way to write this?
blablabla.contains(" ")