REPLACE ( source-string , from-string , to-string )Specifies the base string to make replacements in. The source-string parameter can be any expression that evaluates to a string or a LONGCHAR. The REPLACE function does not change the value of source-string itself; the function returns the string with replacements.Specifies the substring to replace. The from-string parameter can be any expression that evaluates to a string or a LONGCHAR. Each occurrence of from-string within source-string is replaced.Specifies the replacement substring. The to-string parameter can be any expression that evaluates to a string or a LONGCHAR. Each occurrence of from-string in source-string is replaced by to-string.
DEFINE VARIABLE greeting AS CHARACTER NO-UNDO FORMAT "x(40)"INITIAL "Starting user’s session . . . ".IF USERID("DICTDB") < > "" THENgreeting = REPLACE(greeting, "user", USERID("DICTDB")).DISPLAY greeting WITH NO-LABELS.
The REPLACE function replaces all occurrences of from-string within source-string. After replacing a substring, the REPLACE function resumes searching the string after the inserted text. Thus, the inserted text is not recursively searched (in whole or in part) for from-string.
The search for occurrences of from-string within source-string is not case sensitive, unless one of the three values used in the function (source-string, to-string, or from-string) is a case-sensitive field or variable.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |