288 of 323
ZBasic System Library 278 ZX Microcontroller Family StrReplace Type Function returning String Invocation StrReplace(str, findStr, replStr) StrReplace(str, findStr, replStr, startIdx) StrReplace(str, findStr, replStr, startIdx, replCount) StrReplace(str, findStr, replStr, startIdx, replCount, ignoreCase) Parameter Method Type Description str ByVal String The subject string in which to perform replacement. findStr ByVal String The sought string. replStr ByVal String The replacement string. startIdx ByVal integral The index of ’str’ at which to begin the replacement. replCount ByVal integral The number of replacements to perform. ignoreCase ByVal Boolean A flag controlling whether alphabetic case is significant. Discussion This routine produces a new string by replacing occurrences of the sought string with the replacement string in the subject string. If the optional startIdx parameter is not given, the search begins at the first character of the subject string, equivalent to specifying 1 for startIdx. If the optional replCount parameter is not given, all occurrences of the sought string will be replaced. If the optional ignoreCase parameter is not given, the search is performed observing alphabetic case differences, otherwise alphabetic case differences are significant or not depending on the value specified for ignoreCase. For the purposes of this parameter, only the characters A-Z and a-z (&H41 to &H5a and &H61 to &H7a) are considered to be alphabetic. If the subject string contains no occurrences of the sought string, or if the sought string is zero length, or if the replacement count is zero, the returned string will be identical to the subject string. The replacement count and the start index are treated internally as signed 16-bit values. If the value of the start index is less than 1, a starting index of 1 is assumed. Compatibility This function is not available in BasicX compatibility mode.