$strsubst function
$strsubst(string,find,subst)
The $strsubst function replaces all occurrences of find in string by subst. If string is empty, the result is an empty string; if find is empty, the result is a copy of string; if subst is empty, all occurrences of find are removed from string. The search for find is case-insensitive.
Parameters
All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.
- string
- String to search for replacements.
- find
- Substring to replace in string.
- subst
- Replacement string for each occurrence of find.
Examples
Here are some usage examples for this function:
- <$strsubst(C:\Program Files\InstallMate\Bin\Tin.exe, .exe, .ini)>
- Returns C:\Program Files\InstallMate\Bin\Tin.ini from the literal path.
- <$strsubst(<INSTALLDIR>\Bin\Tin.exe, \, |)>
- Returns C:|Program Files|InstallMate|Bin|Tin.exe from the symbolic path, assuming that <INSTALLDIR> resolves to the appropriate folder path.
- <$strsubst(<#Tin_alias>, in, out)>
- Returns C:\Program Files\Tarma outstaller 3\Bout\Tout.exe from the file alias path, assuming that Tin_alias is the file alias for the Tin.exe executable.
- <$strsubst(<#Tin_alias>, ` `,)>
- Returns C:\ProgramFiles\TarmaInstaller3\Bin\Tin.ini from the file alias path, assuming that Tin_alias is the file alias for the Tin.exe executable. Note the use of `backquotes` to specify the space character, and the empty third parameter.