Sample code for 30+ languages & platforms
B4X

StringBuilder ReplaceWord

Demonstrates the ReplaceWord method.

Chilkat B4X Downloads

B4X
Dim sb As ChilkatStringBuilder
sb.Initialize
sb.Append("forest, lumber, lumberjack, jack, timberland")

'  The ReplaceWord method replaces word occurances.

'  For example:
Dim numReplacements As Int = sb.ReplaceWord("lumber", "timber")
numReplacements = sb.ReplaceWord("jack", "joe")

'  The string content is now:
'  forest, timber, lumberjack, joe, timberland
Log(sb.GetAsString)