Function CharRepl() Foundation

Defines characters to replace specified characters in a string.

Syntax
CharRepl( <cSearchChars>   , ;
          <cString>        , ;
          <cReplaceChars>  , ;
          [<lSingleSearch>]  ;  // Default: .F.
        ) --> cResultString
Return

Returns a string where all characters contained in <cSearchChars> are replaced with the corresponding character defined with <cReplaceChars>. If no character of <cSearchChar> is found in <cString> the string remains unchanged.

Description

Parameter <lSingleSearch> defaults to .F. which means that each character of <cSearchChars> is searched in <cString>. If the character is found it is replaced with the corresponding character of <cReplaceChars>. If <cSearchChars> has more characters than <cReplaceChars> the last character of <cReplaceChars> is used as the corresponding character.

When <lSingleSearch> is set .T. each character of <cString> is searched in <cSearchChars>. This prevents from multiple replacements of characters in <cString>.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.