# Position Of Substring
Grammar — Position of substring within string (sensitivity|Sensitive/Insensitive to case)
Flags —Native
|Function
Searches for a substring within a string and returns the numerical position of the substring within the string.
# Arguments
string
— Stringstring
— Substringbool
<preset::String_Case_Sensitivity> — Sensitivity
Returns — int
native int StringFind(string s1, string s2, bool caseSens);
# 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
mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmod — base.stormdata/LibIGHS.galaxy:2154
lv_pick = 1;
for ( ; ( (auto34A22090_ai >= 0 && lv_pick <= auto34A22090_ae) || (auto34A22090_ai < 0 && lv_pick >= auto34A22090_ae) ) ; lv_pick += auto34A22090_ai ) {
lv_delimiterPosition = StringFind(lv_chatString, " ", c_stringNoCase);
lv_heroName = StringSub(lv_chatString, 1, (lv_delimiterPosition - 1));
libIGHS_gv_shuffleSettings.lv_players[lv_player].lv_heroPickOptions[lv_pick] = (lv_heroName);
mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmod — base.stormdata/LibIGHS.galaxy:2204
// Variable Initialization
lv_reshuffleCount = StringToInt(StringSub(EventChatMessage(false), 1, (StringFind(EventChatMessage(false), "picks", c_stringNoCase) - 1)));
for (init_i = 0; init_i <= lv_heroNameCountMax_C; init_i += 1) {
lv_heroAppearences[init_i] = 1;
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2675
// Implementation
lv_fullColorString = CatalogFieldValueGet(c_gameCatalogGameUI, "Dflt", "OverrideColors[" + lp_overrideColor + "].Value[0]", lp_player);
lv_commaPosition = StringFind(lv_fullColorString, ",", c_stringCase);
lv_rString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));
lv_fullColorString = StringSub(lv_fullColorString, (lv_commaPosition + 1), StringLength(lv_fullColorString));
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2678
lv_rString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));
lv_fullColorString = StringSub(lv_fullColorString, (lv_commaPosition + 1), StringLength(lv_fullColorString));
lv_commaPosition = StringFind(lv_fullColorString, ",", c_stringCase);
lv_gString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));
lv_fullColorString = StringSub(lv_fullColorString, (lv_commaPosition + 1), StringLength(lv_fullColorString));
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2681
lv_gString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));
lv_fullColorString = StringSub(lv_fullColorString, (lv_commaPosition + 1), StringLength(lv_fullColorString));
lv_commaPosition = StringFind(lv_fullColorString, ",", c_stringCase);
lv_bString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));
lv_r = (StringToFixed(lv_rString) * 100.0);
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:541
// Implementation
lv_firstdelimiterindex = StringFind(lv_sentence, lp_delimiter, c_stringCase);
while ((lv_firstdelimiterindex == 1) && (StringLength(lv_sentence) > 0)) {
lv_sentence = StringSub(lv_sentence, (lv_delimiterlength + 1), StringLength(lv_sentence));
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:544
while ((lv_firstdelimiterindex == 1) && (StringLength(lv_sentence) > 0)) {
lv_sentence = StringSub(lv_sentence, (lv_delimiterlength + 1), StringLength(lv_sentence));
lv_firstdelimiterindex = StringFind(lv_sentence, lp_delimiter, c_stringCase);
}
if ((lv_firstdelimiterindex == -1) && (StringLength(lv_sentence) == 0)) {
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:565
lv_sentencelength = StringLength(lp_sentence);
lv_clippingwordlength = StringLength(lp_clippingWord);
lv_clippingwordstart = StringFind(lp_sentence, lp_clippingWord, c_stringCase);
lv_remainderstringstart = (lv_clippingwordstart + lv_clippingwordlength);