indexOf method
package app;
public class Main
{
public static void main(String[] args)
{
String text = "123 456 56 78";
int idx = text.indexOf("56");
System.out.println(idx); // 5
}
}
package app;
public class Main
{
public static void main(String[] args)
{
String text = "123 456 56 78";
int idx = text.indexOf("56");
System.out.println(idx); // 5
}
}
Leave a Comment
Cancel reply