ChaiLove API  0.28.0
Public Member Functions
String Class Reference

Provides some additional functionality to the basic string object. More...

Public Member Functions

std::string replace (const std::string &search, const std::string &replace)
 Replaces all instances of the search string with the given replace string. More...
 

Detailed Description

Provides some additional functionality to the basic string object.

Member Function Documentation

◆ replace()

std::string String::replace ( const std::string &  search,
const std::string &  replace 
)

Replaces all instances of the search string with the given replace string.

Parameters
searchThe string to search for that should be replaced.
replaceThe string that will replace the found string.
Returns
The new string with the replaced strings.
var hello = "Hello World!"
var goodbye = hello.replace("Hello", "Goodbye")
// => "Goodbye World!"