CALC and CALCULATE currently can't handle parameters that happen to have parenthesis or commas as part of the string. For example,
$SUBSTITUTE(Good morning, morning, day)
works as expected, but
$SUBSTITUTE(Good, fun morning, morning, day)
does not, assuming the string is
"Good, fun morning"
.
This feature adds quoted text to avoid these "gotchas". Text enclosed in three single quotes is considered a string. Problematic characters (comma, opening and closing parenthesis) are escaped, and the quotes are removed. The escaped characters are restored at the end of the function evaluation.
- Test:
%CALCULATE{$SUBSTITUTE('''Good, fun morning''', morning, day)}%
- Expected:
Good, fun day
- Actual: Good, fun day
--
TWiki:Main/PeterThoeny
- 2013-03-26