Sample code for 30+ languages & platforms
Xbase++

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oSb
LOCAL nBFound

nSuccess := 0

oSb := CreateObject("Chilkat.StringBuilder")
nSuccess := oSb:Append("abc::def::ghi")

//  Replace the 1st occurrence of a substring with another string.
nBFound := oSb:ReplaceFirst("::", "-")

? "bFound = " + Str(nBFound)
? "sb contains: " + oSb:GetAsString()

//  Output is:
//  bFound = True
//  sb contains: abc-def::ghi

oSb:destroy()