Page 1 of 1

string extract

Posted: Tue May 05, 2009 1:43 am
by Sgiri1
hi i have a string like

87658799_qw456huji78_AT_TIME1

i should extract the first '_' delimited field from the string i.e. 87658799
how could this be done through a transformer. can some1 provide the exact function. and also the first '_' string may have any length. nothing can be considered as a constant here.

Posted: Tue May 05, 2009 2:54 am
by mahadev.v
You can use a field function. Field(InputCol,"_",1).

Posted: Tue May 05, 2009 3:01 am
by ShaneMuir
Or the shorthand version:

Code: Select all

InLink.InputCol['_',1,1]

Posted: Tue May 05, 2009 4:15 pm
by ray.wurlod
... which compiles to precisely the same code as the equivalent Field() function.