Hi,
Is there any function like Instr (In String) function of VB. which will returns the position of the first occurrence of a string in another string…
Hi,
Hi,
I think, String.substring() method in Java will fulfill your purpose.
Please see this code:
public class MainClass
{
public static void main( String args[] )
{
String letters = “abcdefghijklmabcdefghijklm”;
// test substring methods
System.out.printf( “Substring from index 20 to end is “%s”\n”,
letters.substring( 20 ) );
System.out.printf( “%s “%s”\n”,
“Substring from index 3 up to, but not including 6 is”,
letters.substring( 3, 6 ) );
} // end main
}
Output:
Substring from index 20 to end is “hijklm”
Substring from index 3 up to, but not including 6 is “def”