# String With Indexed Replacement
Grammar — string with characters from start to end replaced by replaceString
Flags —Native
|Function
Replaces all characters that exist between two other characters in the string.
# Arguments
string
— Stringstring
— Replace Stringint
— Startint
— End
Returns — string
native string StringReplace(
string s,
string replace,
int start,
int end,
);
# Related
Category: String / Substrings
- Word Of String —
string
— StringWord - Substring —
string
— StringSub - Position Of Substring —
int
— StringFind - String Containment —
bool
— StringContains - String With Indexed Replacement —
string
— StringReplace - String With Search Replacement —
string
— StringReplaceWord - Text With Search Replacement —
text
— TextReplaceWord
# Examples
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:7987
lv_newState = "0";
}
libCamp_gf_SetStoryModeRoomStates(StringReplace(lv_states, lv_newState, lv_index, lv_index));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:7987
lv_newState = "0";
}
libCamp_gf_SetStoryModeRoomStates(StringReplace(lv_states, lv_newState, lv_index, lv_index));
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:4032
lv_length = StringLength(lv_name);
lv_subLength = StringLength(lv_subName);
lv_name = StringReplace(lv_name, lv_subName, (lv_length-lv_subLength+1), lv_length);
return lv_name;
}