# String Compare

Grammar — Compares s1 to s2 (sens|Sensitive/Insensitive to case)
FlagsNative | 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

Returns — int

native int StringCompare(
	string s1,
	string s2,
	bool caseSens,
);

Category: String / Comparisons

# Examples

mods/heroes.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmapmap/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.stormmapmap/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.stormmapmap/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.stormmapmap/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.stormmapmap/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.stormmapmap/MapScript.galaxy:820

        }

        if ((StringCompare(lv_heroStringIDs, (gv_pLAYER_AI_EnemyHero), c_stringNoCase) == 0)) {
            lv_currentIndex = lv_itListItemIndex;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:7766

        }

        if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:8067

        }

        if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/heroesdata.stormmodbase.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.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:8234

        }

        if (!((StringCompare(StringWord(lv_enteredString, 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:8317

        }

        if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/heroesmapmods/battlegroundmapmods/battlefieldofeternity.stormmodbase.stormdata/LibMLBD.galaxy:3174

        }

        if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/heroesmapmods/battlegroundmapmods/warheadjunction.stormmodbase.stormdata/LibMSC2.galaxy:2386

        }

        if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/heroesmapmods/battlegroundmapmods/warheadjunction.stormmodbase.stormdata/LibMSC2.galaxy:2430

        }

        if (!((StringCompare(StringWord(EventChatMessage(false), 1), EventChatMessage(true), c_stringNoCase) == 0))) {
            return false;
        }

mods/warcoop/warcoopdata.sc2modbase.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.sc2modbase.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;
        }