Free Support Forum - aspose.com

Is there any Function like inStr in VB

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,


If your query is regarding Cells Product family of Aspose then I am afraid, there is no such direct method is Aspose.Cells JAVA API. Although, you can get any Cell value in string. Check below Technical Article.
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/retrieving-data-from-cells.html

Also you can check Java.Lang Namespace for String Class. IndexOf and LastIndexOf methods can be of your need.
http://download.oracle.com/javase/1.3/docs/api/index.html

Please elaborate your question further if this does not satisfies your query. Thank you.

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”