Fsharp: Replace String

By Xah Lee. Date: .

fsharp: replace string

// 2025-12-29
// replace string

let xoriginal = "something in the water."

let xreplaced = xoriginal.Replace("water", "fire")

printfn "%s" xreplaced
// something in the fire.

// s------------------------------

// replace a char

let xreplacedChar = xoriginal.Replace('o', 'a')   // Replaces single char
printfn "%s" xreplacedChar
// samething in the water.