::EscapeCharacterInstances

Syntax

::model::EscapeCharacterInstances argStr [argChar]

Application

MotionView Tcl

Description

This command will insert a “\” character before every instance of a specified character in a specified string.

Inputs

argStr
This is the string that is to have a “\” character inserted before every instance of the specified character.
argChar
This is the single character that will have a “\” character inserted before every instance of it in the specified string. If this argument is not specified, it is assumed to be “\”.

Example

set myStr "Hello, my name is 'Joe'."
set newStr [::model::EscapeCharacterInstances $myStr "'"]
# newStr should be: Hello, my name is \'Joe\'.

Errors

On successful execution of the command, it will return “argStr” with a “\” inserted before every instance of the character “argChar”.