Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
j_
Contributor
Contributor

string position

Hi ,
  I have a value like this 12%jayanthi%678 ..Now i have to find wat is the position of  % (that is present after Jayanthi ..Position is 13) in the tmap.how to do it?

Labels (2)
4 Replies
Anonymous
Not applicable

You can use "indexOf()" or "lastIndexOf()" to get the position of a char within a String. In this case it looks like "lastIndexOf()" might be what you need. However, you need to be a bit more precise with your requirement. Is it always the last instance of the character that you want?

Check out the String methods available to you here ( http://docs.oracle.com/javase/7/docs/api/java/lang/String.html).
j_
Contributor
Contributor
Author

Hi ,
   Yeah always its the last.
j_
Contributor
Contributor
Author

But the lastindexof couldnt be use in the tmap
Anonymous
Not applicable

Yes it can. You can use Java in the tMap expressions. If you want to do something a bit more complicated than one expression, you can code your own method in a routine which can be used in the tMap. Talend is just a code generator. Java can be used in a lot of areas.