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

Arduino Stub for Battery Pack for JBL XTREAME 2

This program is designed to be written on Arduino or ATtiny85 and acts as a stub to respond to the speaker's requests via the I2C pro...