Important: The information in this document is obsolete and should not be used for new development.
ReplaceText
TheReplaceTextfunction searches text, replacing all instances of a string in that text with another string.ReplaceTextsearches 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
ReplaceTextis to substitute text.substitutionText- A handle to the string that
ReplaceTextuses as substitute text.key- A Pascal string of less than 16 bytes that
ReplaceTextsearches for.DESCRIPTION
ReplaceTextsearches the text specified by thebaseTextparameter for instances of the string in thekeyparameter and replaces each instance with the text specified by thesubstitutionTextparameter.ReplaceTextsearches 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.
ReplaceTextreturns 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 constantnoErris returned if there was no error and no substitutions were performed.SPECIAL CONSIDERATIONS
ReplaceTextmay move memory; your application should not call this function at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theReplaceTextfunction are
Trap macro Selector _ScriptUtil $820C FFDC RESULT CODES
nilHandleErr 109 GetHandleSizefails onbaseTextorsubstitutionTextmemFullErr 108 SetHandleSizefails onbaseTextmemWZErr -111 GetHandleSizefails onbaseTextorsubstitutionText