Skip to main content
Hi,

 

 

I'm trying to create an attribute that is simply the final character of another attribute. Using the substring extractor I can remove the final character with and stand and end on 0 and -2, and I can extract a character at a known location with 18, 19. The length of string hoewever vary so I need to find a way of dealing wit the last character rather than the xth. Is there another combination of start and end index that will allow me to do this or do I need another transformer?

 

 

Thanks
Negative values are calculated from the end of the string. Perhaps use a start of -1 and end of -1?
You can as well extract this last character using a StringSearcher with a Regular Expression: (.){1}$.

 

 

The dot means any character (except new lines)

 

The number in curly brackets indicates the number of characters you want to get

 

the dollar sign means the end of the string

 

 

In our case the expression would match the any 1 character before the end of the string (i.e.: the end of the string)

Reply