How to determine the number of spaces on the beginning of a String

String s = "     London is a capital of Great Britain  ";
int beginningSpaces = s.indexOf(s.trim());

No comments:

Post a Comment