Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All Experts ,
I have multiple cases I am handling in Tmap .
Case 1 :
I have string like "125,12NC"
How to remove Alphabetic characters from above string in Tmap ?
Case 2 :
I have string like :
"1812281228C125,12NCOL851711644078226,851711644078226 NG KIM LAI"
Out of this string , I have to take only last string which is have splitted using below function
row7.data.split(",") [ 2 ]
But instead of '2' i have to put a generic code which will take a last index only in [] . How to do that ?
I tried using
row7.data.split(",") [ row7.data.lastIndexof(",")]
But this did not worked out .
Can you please help me how to achieve above scenarios .
For Case 1:
Use replaceAll([^a-zA-Z], "") in tMap expression builder to get rid of Alphabets.
For Case2:
Put your desired value in a context variable(mind the datatype it should be int) and use that in split function.
row7.data.split(",",context.value) ;
Let us know if this helps.
For Case 2: If you want always the last value then you can do
row7.data.split(",")[row7.data.split(",").length-1];
@ Raghuram ,
I have tried below expression but throwing me error ;
(row7.data.substring(11,19)).replaceAll([^a-zA-Z], "")
For Case 2 :
I ant go with that solution . Because I am not sure which Index Number will be considered as last one . It may 1,2,3,4 ..based on our splitting .
Thanks . For Case 2 : That's a Right Solution .