// By Martin Theriault Dec 29 2015
Input,
String to be modified,
Characters to be replace,
Replacement Characters
ReplaceStr("Eur.Usd",".","_") = "Eur_Usd"
ReplaceStr("Hello my name is Martin", "my", "your") = "Hello your name is Martin"
ReplaceStr("Hello my name is Martin", "Martin", "Paul") + "Hello my name is Paul"
Code: Select all
//ReplaceSTR will replace a series of characters with the new one
Input:
InputString(String),
Lookfor (String),
ReplaceBy (String);
Var:
Position(-1),
LengthInput (0),
Length_ReplaceBy (0),
Length_LookFor (0),
Temp_Length (0),
TempString ("");
LengthInput = strlen(InputString);
Length_Lookfor = strlen(Lookfor);
Length_ReplaceBy = StrLen(ReplaceBy);
Position = Instr(InputString,LookFor);
TempString =LeftStr(inputString,(position-1 ))+ replaceby;
Temp_Length = StrLen(TempString);
TempString = tempstring + RightStr(InputString, (LengthInput -(position + length_lookfor -1)));
replacestr = Tempstring;
print ("exit>: , ", replacestr);