# String Compare
Grammar — Compares s1 to s2 (sens|Sensitive/Insensitive to case)
Flags —Native
|Function
Returns 0 if the two strings are the same. Positive value means first character that doesn*“t match is greater in String1. Negative means it”*s greater in String2.
# Arguments
string
— String 1string
— String 2bool
<preset::String_Case_Sensitivity> — Sensitivity
Returns — int
native int StringCompare(
string s1,
string s2,
bool caseSens,
);
# Related
Category: String / Comparisons
- String Equal —
bool
— StringEqual - String Compare —
int
— StringCompare - String Length —
int
— StringLength
# Examples
mods/heroes.stormmod — base.stormmaps/maps/heroes/singleplayermaps/%2810%29trymemode.stormmap/MapScript.galaxy:772
for ( ; ( (auto495632A1_ai >= 0 && lv_itHeroIndex <= auto495632A1_ae) || (auto495632A1_ai < 0 && lv_itHeroIndex >= auto495632A1_ae) ) ; lv_itHeroIndex += auto495632A1_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeAllyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod — base.stormmaps/maps/heroes/singleplayermaps/%2810%29trymemode.stormmap/MapScript.galaxy:772
for ( ; ( (auto495632A1_ai >= 0 && lv_itHeroIndex <= auto495632A1_ae) || (auto495632A1_ai < 0 && lv_itHeroIndex >= auto495632A1_ae) ) ; lv_itHeroIndex += auto495632A1_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeAllyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod — base.stormmaps/maps/heroes/singleplayermaps/%2810%29trymemode.stormmap/MapScript.galaxy:778
}
if ((StringCompare(lv_heroStringIDs, (gv_pLAYER_AI_AllyHero), c_stringNoCase) == 0)) {
lv_currentIndex = lv_itListItemIndex;
}
mods/heroes.stormmod — base.stormmaps/maps/heroes/singleplayermaps/%2810%29trymemode.stormmap/MapScript.galaxy:814
for ( ; ( (autoCD56D3BC_ai >= 0 && lv_itHeroIndex <= autoCD56D3BC_ae) || (autoCD56D3BC_ai < 0 && lv_itHeroIndex >= autoCD56D3BC_ae) ) ; lv_itHeroIndex += autoCD56D3BC_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeEnemyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod — base.stormmaps/maps/heroes/singleplayermaps/%2810%29trymemode.stormmap/MapScript.galaxy:814
for ( ; ( (autoCD56D3BC_ai >= 0 && lv_itHeroIndex <= autoCD56D3BC_ae) || (autoCD56D3BC_ai < 0 && lv_itHeroIndex >= autoCD56D3BC_ae) ) ; lv_itHeroIndex += autoCD56D3BC_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeEnemyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod — base.stormmaps/maps/heroes/singleplayermaps/%2810%29trymemode.stormmap/MapScript.galaxy:820
}
if ((StringCompare(lv_heroStringIDs, (gv_pLAYER_AI_EnemyHero), c_stringNoCase) == 0)) {
lv_currentIndex = lv_itListItemIndex;
}
mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/(10)trymemode.stormmap — map/MapScript.galaxy:772
for ( ; ( (auto495632A1_ai >= 0 && lv_itHeroIndex <= auto495632A1_ae) || (auto495632A1_ai < 0 && lv_itHeroIndex >= auto495632A1_ae) ) ; lv_itHeroIndex += auto495632A1_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeAllyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/(10)trymemode.stormmap — map/MapScript.galaxy:772
for ( ; ( (auto495632A1_ai >= 0 && lv_itHeroIndex <= auto495632A1_ae) || (auto495632A1_ai < 0 && lv_itHeroIndex >= auto495632A1_ae) ) ; lv_itHeroIndex += auto495632A1_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeAllyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/(10)trymemode.stormmap — map/MapScript.galaxy:778
}
if ((StringCompare(lv_heroStringIDs, (gv_pLAYER_AI_AllyHero), c_stringNoCase) == 0)) {
lv_currentIndex = lv_itListItemIndex;
}
mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/(10)trymemode.stormmap — map/MapScript.galaxy:814
for ( ; ( (autoCD56D3BC_ai >= 0 && lv_itHeroIndex <= autoCD56D3BC_ae) || (autoCD56D3BC_ai < 0 && lv_itHeroIndex >= autoCD56D3BC_ae) ) ; lv_itHeroIndex += autoCD56D3BC_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeEnemyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/(10)trymemode.stormmap — map/MapScript.galaxy:814
for ( ; ( (autoCD56D3BC_ai >= 0 && lv_itHeroIndex <= autoCD56D3BC_ae) || (autoCD56D3BC_ai < 0 && lv_itHeroIndex >= autoCD56D3BC_ae) ) ; lv_itHeroIndex += autoCD56D3BC_ai ) {
lv_heroStringIDs = DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex)));
if ((CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[ShowInStore]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[PreventTryMeLaunch]", c_playerAny) == 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowAIRandomSelection]", c_playerAny) != 0) && (CatalogFieldValueGetAsInt(c_gameCatalogHero, (lv_heroStringIDs), "Flags[AllowHumanRandomSelection]", c_playerAny) != 0) && (StringCompare(lv_heroStringIDs, "Cho", c_stringNoCase) != 0) && (StringCompare(lv_heroStringIDs, "Gall", c_stringNoCase) != 0)) {
lv_itListItemIndex += 1;
DialogControlAddItem(gv_tryMeModePanel.lv_changeEnemyPulldown, PlayerGroupAll(), StringExternal(("Hero/Name/" + DataTableGetString(true, ("HeroIndex_" + IntToString(lv_itHeroIndex))))));
mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/(10)trymemode.stormmap — map/MapScript.galaxy:820
}
if ((StringCompare(lv_heroStringIDs, (gv_pLAYER_AI_EnemyHero), c_stringNoCase) == 0)) {
lv_currentIndex = lv_itListItemIndex;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:7766
}
if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:8067
}
if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:8078
TriggerEnable(TriggerGetCurrent(), false);
if ((StringCompare(EventChatMessage(false), EventChatMessage(true), c_stringNoCase) == 0)) {
TextExpressionSetToken("Param/Expression/lib_Sprt_3FB0E761", "A", TextTimeFormat(StringToText("<min2/>:<sec2/>"), FixedToInt(TimerGetElapsed(libGame_gv_gameTimer))));
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, TextExpressionAssemble("Param/Expression/lib_Sprt_3FB0E761"));
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:8234
}
if (!((StringCompare(StringWord(lv_enteredString, 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:8317
}
if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/heroesmapmods/battlegroundmapmods/battlefieldofeternity.stormmod — base.stormdata/LibMLBD.galaxy:3174
}
if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/heroesmapmods/battlegroundmapmods/warheadjunction.stormmod — base.stormdata/LibMSC2.galaxy:2386
}
if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/heroesmapmods/battlegroundmapmods/warheadjunction.stormmod — base.stormdata/LibMSC2.galaxy:2430
}
if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
return false;
}
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:416
for ( ; ( (auto3A50006D_ai >= 0 && lv_charindex <= auto3A50006D_ae) || (auto3A50006D_ai < 0 && lv_charindex >= auto3A50006D_ae) ) ; lv_charindex += auto3A50006D_ai ) {
lv_character = StringSub(lp_string, lv_charindex, lv_charindex);
if (((StringCompare(lv_character, "0", c_stringCase) < 0) || (StringCompare(lv_character, "9", c_stringCase) > 0))) {
return false;
}
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:416
for ( ; ( (auto3A50006D_ai >= 0 && lv_charindex <= auto3A50006D_ae) || (auto3A50006D_ai < 0 && lv_charindex >= auto3A50006D_ae) ) ; lv_charindex += auto3A50006D_ai ) {
lv_character = StringSub(lp_string, lv_charindex, lv_charindex);
if (((StringCompare(lv_character, "0", c_stringCase) < 0) || (StringCompare(lv_character, "9", c_stringCase) > 0))) {
return false;
}