AnsweredAssumed Answered

Bug with substitute function and quote character char(34)

Question asked by MacEasy on Aug 19, 2014
Latest reply on Aug 19, 2014 by MacEasy

So I ran into an interesting little problem today.

I'm doing an exact search (==) in a field in a script and it was failing because the users are entering values with a quote in them


For example they might enter into the field

The length is 12" long


So then if you need to do an exact search

"==" & $fieldcontents it doesn't work.


No problem, we actually just have to escape for the quote symbol with "


But there in lies the problem the substitute function won't substitute.


So try this if you don't believe me, where char(34) = quote (") and char(92) = escape symbol ()

Substitute("12" & Char(34);Char(92) & Char(34);Char(34))


this should return 12/", but instead returns 12"

If you use patterncount, it sees the quote symbol.


Now I have a work around... I can run a loop using the replace function and that seems to do the trick, because it doesn't seem to be afflicted by the same issue.


Anyone else run into this? and find a fix?

Test in FM12v4 advanced and FM13v3