I've found this documentation that mentions that comma should be surrounded with quotes when using in string functions. But the case now that I receive a file name (which contain comma) in a published parameter, then I want to replace part of the file path with some other string using "StringReplacer" function. I can't do this as the value retrieved in the published parameter has already the comma. Any Advise?
I'm not sure I fully understand but what you could do is use a ParameterFetcher and a FeatureReader to change the value. String Functions require commas to be escaped because that is the character used to separate the arguments (i..e ReplaceString(string,before,after[,caseSensitive={TRUE|FALSE}])).
Are you wanting to change the filename before reading it in? If so maybe use a Path Reader to get the file path and a SystemCaller (rename a file from the command line) to remove the comma from the filename if applicable and then read the file in with the FeatureReader.
ps. the link you provided is very old documentation, here is the latest and greatest on StringFunctions.
Hi @mustafa.salah , the documentation you found is very old, maybe about 10 years old. This is the current one.
Also, the documentation describes about FME String Functions, not about string transformers such as StringReplacer, so the description about escaping in the documentation isn't applied to the StringReplacer usage. See the StringReplacer Help to learn how you can use the transformer.
If you need to replace a specific string within a published parameter value with another string using the StringReplacer transformer, a possible way is to insert these transformers into the workflow.
ParameterFetcher: Assign the parameter value to a feature attribute.
StringReplacer: Replace the specific string within the attribute with another string.
I'm not sure I fully understand but what you could do is use a ParameterFetcher and a FeatureReader to change the value. String Functions require commas to be escaped because that is the character used to separate the arguments (i..e ReplaceString(string,before,after[,caseSensitive={TRUE|FALSE}])).
Are you wanting to change the filename before reading it in? If so maybe use a Path Reader to get the file path and a SystemCaller (rename a file from the command line) to remove the comma from the filename if applicable and then read the file in with the FeatureReader.
ps. the link you provided is very old documentation, here is the latest and greatest on StringFunctions.
Thanks. I ended up with a similar solution, but I used Attribute Creator in my case.
Thanks so much. I ended up using the StringReplacer Transformer rather than the function in text editor.