replaceAll()

From Hack Wars Wiki

Jump to: navigation, search


Information for free function replaceAll()
Function replaceAll(string s1, string s2, string s3)
API Attacking, Banking, FTP, Watch, HTTP, Challenges, Hacktendo
Description Returns a string which has all instances of s2 in s1 replaced with s3.


Example

string lineStr = "This is a story about a man named Bob. Bob was a man."
string replacedStr = replaceAll(lineStr, "Bob", "Alice");
string replacedStr2 =  replaceAll(lineStr, "man", "woman");


Result:

 replacedStr = "This is a story about a man named Alice. Alice was a man."
 replacedStr2 =  "This is a story about a woman named Bob. Bob was a woman."
Personal tools