Pages

Determine character location in a String

Now, i will share with you, how to determine location of a character in a String. Ok...firstly you must know location of a character in a String is determine using 'index'. Index for first character in a String is equal to 0 and each character include white space after that will add 1.

Note : Character location = index

String a="Hello dude";

Below is a list all character in String above with it's index.

H - 0
e - 1
l - 2
l - 3
o - 4
white space - 5
d - 6
u - 7
d - 8
e - 9
Related Posts Plugin for WordPress, Blogger...