VBScript
VBScript
StringBuilder RemoveAfterFinal
Demonstrates the StringBuilder.RemoveAfterFinal method.The GetBefore method was added in Chilkat v9.5.0.77
Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set sb = CreateObject("Chilkat.StringBuilder")
success = sb.Append("abc::def::ghi")
' Replace the 1st occurrence of a substring with another string.
bFound = sb.ReplaceFirst("::","-")
outFile.WriteLine("bFound = " & bFound)
outFile.WriteLine("sb contains: " & sb.GetAsString())
' Output is:
' bFound = True
' sb contains: abc-def::gh
outFile.Close