11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$TRANSLATE$TRANSLATEPerforms character-for-character replacement within a string.$TRANSLATE(string,identifier,associator)$TR(string,identifier,associator)ParametersstringidentifierassociatorThe target string. It can be a numeric value, a string literal, the nameof a variable, or any valid <strong>Caché</strong> <strong>ObjectScript</strong> expression.The character(s) to search for in string. It can be a numeric value,a string literal, the name of a variable, or any valid <strong>Caché</strong><strong>ObjectScript</strong> expression.Optional — The replacement character(s) corresponding to eachcharacter in the identifier. It can be a numeric value, a string literal,the name of a variable, or any valid <strong>Caché</strong> <strong>ObjectScript</strong> expression.DescriptionThe $TRANSLATE function performs character-for-character replacement within a string.It processes the string parameter one character at a time. Initially, $TRANSLATE sets theoutput string to the input string. It compares each character in the input string with eachcharacter in the identifier parameter. If $TRANSLATE finds a match, it makes note of theposition of that character.• The two-argument form of $TRANSLATE removes those characters in the identifierparameter from the output string.• The three-argument form of $TRANSLATE replaces the identifier character(s) foundin the string with the positionally corresponding character(s) from the associatorparameter. Replacement is performed on a character, not a string, basis. If the identifierparameter contains fewer characters than the associator parameter, the excess character(s)in the associator parameter are ignored. If the identifier parameter contains more charactersthan the associator parameter, the excess character(s) in the identifier parameter aredeleted in the output string.$TRANSLATE by itself does not change the string parameter. To change the input string,you must SET it equal to a translation of itself.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 307

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!