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 PROMOTIC system, it is more usefull to use the method: Pm.StringReplace.

Syntax:
Replace(expression As String, find As String, replacewith As String, [start As Integer], [count As Integer], [compare As Integer]) As String
Calling:
s = Replace(expression, find, replacewith[, start[, count[, compare]]])
Parameters:
expression(String) String expression 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) Number of substring substitutions to perform. If not set, then the value is -1, which 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:
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:
Dim sString
' a binary comparison starting at the beginning of the string. Returns "XXYXXPXXY".
sString = Replace("XXpXXPXXp", "p", "Y")
' a textual comparison starting at position 3. Returns "YXXYXXY".
sString = Replace("XXpXXPXXp", "p", "Y", 3, -1, 1)
PROMOTIC 8.3.21 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