CharReplace
InstallShield 2020 ยป InstallScript Language Reference
The CharReplace function replaces all instances of the character cFind with cReplace in the string svString, except characters whose string index is less than nStart. The string index of the first character in a string is 0.
Syntax
CharReplace ( svString, cFind, cReplace, nStart );
Parameters
Parameter |
Description |
svString |
Specifies the string whose characters will be replaced, and returns the modified string. |
cFind |
Specifies the character to be replaced. Use the STRTOCHAR function to specify a char literal as cFind; for example: CharReplace( svString, STRTOCHAR('a'), STRTOCHAR('e'), nStart ); |
cReplace |
Specifies the character to replace cFind. Use the STRTOCHAR function to specify a char literal as cReplace; for example: CharReplace( svString, STRTOCHAR('a'), STRTOCHAR('e'), nStart ); |
nStart |
Specifies the string index at which to begin searching for cFind. Note that the string index of the first character in svString is 0 (zero). If you want to replace all instances of cFind in svString, specify 0 for nStart. |
Return Values
Return Value |
Description |
X |
The total number of replacements of cFind by cReplace. |
< ISERR_SUCCESS |
The function failed to replace the characters. |
Additional Information
cFind or cReplace can be null characters ('\0'). To handle null-delimited strings, specify cFind or cReplace as StrToChar('\0'); note that the constant NULL is 0, not '\0', and cannot be used to specify the null character. When cFind or cReplace is '\0', CharReplace automatically sets the last two characters of the string buffer to '\0' before returning; therefore, the size of the string (which should be set explicitly) should be at least the number of characters to be stored plus two.
See Also