How to replace some string with Nim ?
var pythonista:string = "Power of Python!"
echo pythonista
How to replace some string with Nim ?
var pythonista:string = "Power of Python!"
echo pythonista
First, you need to import strutils
module. Strutils is the module that defines several common functions for working with strings.
So the code will be like this:
import std/strutils
var pythonista:string = "Power of Python!"
echo pythonista
echo "============"
echo pythonista.replace("Python!", "Nim :)")
echo "============"
© 2022 - 2024 — McMap. All rights reserved.
std
namespace prefix, soimport std/strutils
– Inimitable