Important: The information in this document is obsolete and should not be used for new development.
ReplaceText
TheReplaceText
function searches text, replacing all instances of a string in that text with another string.ReplaceText
searches on a character-by-character basis (as opposed to byte-by-byte), so it works properly for all script systems.
FUNCTION ReplaceText (baseText, substitutionText: Handle; key: Str15): Integer;
baseText
- A handle to the string in which
ReplaceText
is to substitute text.substitutionText
- A handle to the string that
ReplaceText
uses as substitute text.key
- A Pascal string of less than 16 bytes that
ReplaceText
searches for.DESCRIPTION
ReplaceText
searches the text specified by thebaseText
parameter for instances of the string in thekey
parameter and replaces each instance with the text specified by thesubstitutionText
parameter.ReplaceText
searches on a character-by-character basis. It recognizes 2-byte characters in script systems that contain them and advances the search appropriately after encountering a 2-byte character.
ReplaceText
returns an integer value. If the returned value is positive, it indicates the number of substitutions performed; if it is negative, it indicates an error. The constantnoErr
is returned if there was no error and no substitutions were performed.SPECIAL CONSIDERATIONS
ReplaceText
may move memory; your application should not call this function at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theReplaceText
function are
Trap macro Selector _ScriptUtil $820C FFDC RESULT CODES
nilHandleErr 109 GetHandleSize
fails onbaseText
orsubstitutionText
memFullErr 108 SetHandleSize
fails onbaseText
memWZErr -111 GetHandleSize
fails onbaseText
orsubstitutionText