One Star

how to find Last index of the substring in a string?

hello,
if i have a string "hello how are you?test?12?are^&%^"
How to find the index of the last "?"
kindly suggest me for this issue ..
Thanks in advance
nilesh r
6 REPLIES
One Star

Re: how to find Last index of the substring in a string?

Method lastIndexOf(String str) of the String class Smiley Happy
One Star

Re: how to find Last index of the substring in a string?

i dont have such option in string class . im using "talend open studio 4.1.1 r50363..
is there any other option to do so?
One Star

Re: how to find Last index of the substring in a string?

Well, why not a little While loop with method indexOf(String str, int fromIndex) ? Or a For one, char by char. Can't tell you more Smiley Happy
One Star

Re: how to find Last index of the substring in a string?

If it's a Java project use stringname.lastIndexOf('?')
One Star

Re: how to find Last index of the substring in a string?

i need to do the same inside tmap with some string function .because i have some process done inside my "tmap" .
Im beginner level in talend .pls suggest me..
One Star

Re: how to find Last index of the substring in a string?

i need to do the same inside tmap with some string function .because i have some process done inside my "tmap" .
Im beginner level in talend .pls suggest me..

So what do you want to do?