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 omitted, 1 is assumed. Must be used in conjunction with count.
count[optional] (Integer) Number of substring substitutions to perform. If omitted, the default value is -1, which means make all possible substitutions. Must be used in conjunction with start.
compare[optional] (Integer) numeric value indicating the kind of comparison to use when evaluating substrings. If omitted, 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 ("") - when "expression" is empty string or when "start" > Len("expression")
copy of "expression" - when "find" is empty string or when "count" is 0
Copy of expression with all occurrences of "find" removed - when "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)
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice