string position

One Star

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?

Ten Stars

Re: string position

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).
One Star

Re: string position

Hi ,
   Yeah always its the last.
One Star

Re: string position

But the lastindexof couldnt be use in the tmap
Ten Stars

Re: string position

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.

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog