Sample code for 30+ languages & platforms
PowerShell

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$sb = New-Object Chilkat.StringBuilder
$success = $sb.Append("abc::def::ghi")

# Replace the 1st occurrence of a substring with another string.
$bFound = $sb.ReplaceFirst("::","-")

$("bFound = " + $bFound)
$("sb contains: " + $sb.GetAsString())

# Output is:
# bFound = True
# sb contains: abc-def::gh