Skip to main content

Hello!

I'm trying to use the following to find the position of a character/string in one of my attributes:

@FindString(@Value(ColumnName),TEXT,1,caseSensitive=TRUE)

When I replace TEXT with the text I am searching for, this works as expected, except for when the text to be found is a parenthesis, i.e. ( or ). In that case, the function interprets the parenthesis as the start or end of the function's arguments. I tried to escape the parenthesis using a forward slash (as suggested by the FindString() documentation to escape a quotation mark) as well as by surrounding it with quotation marks (as suggested by the FindString() documentation to escape a comma), but neither of these work.

How can I properly escape ( and ) inside the function arguments?

Thank you!

@FindString(@Value(test),"(",1,caseSensitive=TRUE)

This is the correct syntax, note that it does show as an error in a AttributeCreator. Do note that FME uses zero indexes for searching/counting/lists. So setting the StartIndex to '1' is actually starting at the second character. So if your string starts with a '(' then it won't find it.

 

Another option is to also look at the StringSearcher transformer


Reply