Basic java

Soldato
Joined
28 Oct 2006
Posts
12,457
Location
Sufferlandria
Im trying to find the position of a comma in a string.

using indexOf()
atm i'v got indexOf(",") but its returning null (there definately are commas in the string btw).
Iv also tried indexOf(',') and indexOf(COMMA)

How do i make it work? :(
 
Either ' or " will work.

String str = "one two, three";
str.indexOf(",");

OR

str.indexOf(',');
 
Back
Top Bottom