Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Replace - function of language VBScript

Description:
Returns a string in which a specified substring has been replaced with another substring a specified number of times.

For the purposes of the PROMOTIC system, it is more usefull to use the method: Pm.StringReplace.

Syntax:
String Replace(String expression, String find, String replacewith, [Integer start], [Integer count], [Integer compare])
Calling:
s = Replace(expression, find, replacewith[, start[, count[, compare]]])
Parameters:
expression(String) Text string containing substring to replace
find(String) Substring being searched for
replacewith(String) Replacement substring
start[optional] (Integer) Position within expression where substring search is to begin. If not set, then 1 is assumed.
count[optional] (Integer) Specifies the number of substring substitutions to perform. If not set, then the value is -1 (means make all possible substitutions).
compare[optional] (Integer) Numeric value indicating the kind of comparison to use when evaluating substrings. If not set, then a binary comparison is performed.
vbBinaryCompare - perform a binary comparison
vbTextCompare - perform a textual comparison
Return Values:
Text string, with substitutions made, that begins at the position specified by "start" and and concludes at the end of the "expression" string. It is not a copy of the original string from "start" to finish. Special cases:
empty string ("") - if "expression" is empty string or if "start" > Len("expression").
copy of "expression" - if "find" is empty string or if "count" is 0.
Copy of expression with all occurrences of "find" removed - if "replacewith" is empty string.
Example:
VBScriptSelect and copy to clipboard

Dim sString
'Binary comparison starting at the beginning of the string. Returns a value "XXYXXPXXY"
sString = Replace("XXpXXPXXp", "p", "Y")
'Textual comparison starting at position 3. Returns a value "YXXYXXY"
sString = Replace("XXpXXPXXp", "p", "Y", 3, -1, 1)
PROMOTIC 9.0.8 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice