# String Length

Grammar — Length of s
FlagsNative | Function

Returns the number of characters within a string.

# Arguments

  • string — String

Returns — int

native int StringLength(string s);

Category: String / Comparisons

# Examples

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:18542

    if (((libSwaC_gf_StoryMapTypeCheck(libSwaC_gf_CurrentMap(), c_mapKindMission) == true) || (libSwaC_gf_StoryMapTypeCheck(libSwaC_gf_CurrentMap(), c_mapKindUpgrade) == true)) && (libSwaC_gf_CurrentMissionIsSimulation() == false)) {
        lv_missionInitial = libSwaC_gf_ZS_MissionInitial(libSwaC_gf_CurrentMap());
        if ((StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder) > 0)) {
            lv_lastLocation = StringSub(libSwaC_gv_zSX_CamStatsMisisonOrder, StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder), StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder));
        }

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:18543

        lv_missionInitial = libSwaC_gf_ZS_MissionInitial(libSwaC_gf_CurrentMap());
        if ((StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder) > 0)) {
            lv_lastLocation = StringSub(libSwaC_gv_zSX_CamStatsMisisonOrder, StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder), StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder));
        }
        else {

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:18543

        lv_missionInitial = libSwaC_gf_ZS_MissionInitial(libSwaC_gf_CurrentMap());
        if ((StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder) > 0)) {
            lv_lastLocation = StringSub(libSwaC_gv_zSX_CamStatsMisisonOrder, StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder), StringLength(libSwaC_gv_zSX_CamStatsMisisonOrder));
        }
        else {

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:18658

    }

    if ((StringLength(libSwaC_gv_zSX_CamStatsWeaponArmorUpgrades) > 0)) {
        libSwaC_gv_zSX_CamStatsWeaponArmorUpgrades = (libSwaC_gv_zSX_CamStatsWeaponArmorUpgrades + " | ");
    }

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:18764

    }

    if ((StringLength(libSwaC_gv_zSX_CamStatsWeaponArmorUpgrades) > 150)) {
        return true;
    }

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:23738

    // Automatic Variable Declarations
    // Variable Initialization
    lv_bookmark = StringSub(EventChatMessage(false), 8, StringLength(EventChatMessage(false)));

    // Conditions

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ptaldarim02.sc2map/MapScript.galaxy:580

    // Implementation
    autoE7A604C4_ae = lp_digits;
    lv_i = StringLength(lv_intString);
    for ( ; ( (autoE7A604C4_ai >= 0 && lv_i <= autoE7A604C4_ae) || (autoE7A604C4_ai < 0 && lv_i >= autoE7A604C4_ae) ) ; lv_i += autoE7A604C4_ai ) {
        lv_intString = ("0" + lv_intString);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ptaldarim02.sc2mapMapScript.galaxy:580

    // Implementation
    autoE7A604C4_ae = lp_digits;
    lv_i = StringLength(lv_intString);
    for ( ; ( (autoE7A604C4_ai >= 0 && lv_i <= autoE7A604C4_ae) || (autoE7A604C4_ai < 0 && lv_i >= autoE7A604C4_ae) ) ; lv_i += autoE7A604C4_ai ) {
        lv_intString = ("0" + lv_intString);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10233

    // Automatic Variable Declarations
    // Variable Initialization
    lv_bookmark = StringSub(EventChatMessage(false), 8, StringLength(EventChatMessage(false)));

    // Conditions

mods/core.sc2modbase.sc2data/TriggerLibs/NativeLib.galaxy:5449

    // Implementation
    libNtve_gf_SendActorMessageToUnit(lp_unit, libNtve_gf_ModelSwap(lp_model, lp_percent));
    if ((StringLength(lp_textures) > 0)) {
        libNtve_gf_SendActorMessageToUnit(lp_unit, MakeMsgTextureSelectBySlot("main", c_textureSlotComponentDefault, ("BestMatch " + lp_textures)));
    }

mods/core.stormmodbase.stormdata/TriggerLibs/NativeLib.galaxy:4641

    // Implementation
    libNtve_gf_SendActorMessageToUnit(lp_unit, libNtve_gf_ModelSwap(lp_model, lp_percent));
    if ((StringLength(lp_textures) > 0)) {
        libNtve_gf_SendActorMessageToUnit(lp_unit, MakeMsgTextureSelectBySlot("main", c_textureSlotComponentDefault, ("BestMatch " + lp_textures)));
    }

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:1901

    }

    if ((StringLength(lv_chatString) >= 13)) {
        lv_heroName = StringSub(lv_chatString, 13, StringLength(lv_chatString));
        lv_hero = (lv_heroName);

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:1902


    if ((StringLength(lv_chatString) >= 13)) {
        lv_heroName = StringSub(lv_chatString, 13, StringLength(lv_chatString));
        lv_hero = (lv_heroName);
    }

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:2067

    }
    if ((StringSub(lv_chatString, 13, 13) == "0")) {
        lv_roleString = StringSub(lv_chatString, 15, StringLength(lv_chatString));
    }
    else {

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:2070

    }
    else {
        lv_roleString = StringSub(lv_chatString, 14, StringLength(lv_chatString));
    }
    lv_roleString = StringCase(lv_roleString, false);

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:2146

    if ((StringSub(lv_chatString, 13, 13) == "0")) {
        lv_player = StringToInt(StringSub(lv_chatString, 12, 13));
        lv_chatString = StringSub(lv_chatString, 15, StringLength(lv_chatString));
    }
    else {

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:2150

    else {
        lv_player = StringToInt(StringSub(lv_chatString, 12, 12));
        lv_chatString = StringSub(lv_chatString, 14, StringLength(lv_chatString));
    }
    lv_pick = 1;

mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmodbase.stormdata/LibIGHS.galaxy:2157

        lv_heroName = StringSub(lv_chatString, 1, (lv_delimiterPosition - 1));
        libIGHS_gv_shuffleSettings.lv_players[lv_player].lv_heroPickOptions[lv_pick] = (lv_heroName);
        lv_chatString = StringSub(lv_chatString, (lv_delimiterPosition + 1), StringLength(lv_chatString));
    }
    libIGHS_gv_shuffleSettings.lv_players[lv_player].lv_heroPickOptions[3] = (lv_chatString);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:2677

    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));
    lv_commaPosition = StringFind(lv_fullColorString, ",", c_stringCase);
    lv_gString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:2680

    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));
    lv_commaPosition = StringFind(lv_fullColorString, ",", c_stringCase);
    lv_bString = StringSub(lv_fullColorString, 1, (lv_commaPosition - 1));

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:4030

    lv_name = "Line00000";
    lv_subName = IntToString(lp_index);
    lv_length = StringLength(lv_name);
    lv_subLength = StringLength(lv_subName);
    lv_name = StringReplace(lv_name, lv_subName, (lv_length-lv_subLength+1), lv_length);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:4031

    lv_subName = IntToString(lp_index);
    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;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/MapMechanicsLib.galaxy:2308

    CutsceneCreateNoPosition(lp_cutscene, libCore_gv_playerGroupFromPlayer[lp_player], false);
    libMapM_gv_mMIntroCutscene[lp_player] = CutsceneLastCreated();
    if ((StringLength(lp_filter) > 0)) {
        CutsceneAddFilter(CutsceneLastCreated(), lp_filter);
    }

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

    }

    if ((StringLength(StringWord(EventChatMessage(false), 2)) > 1)) {
        lv_amount = StringToInt(StringWord(EventChatMessage(false), 2));
    }

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

    }

    auto1E503F1D_val = StringSub(EventChatMessage(false), 5, StringLength(EventChatMessage(false)));
    if (auto1E503F1D_val == "start") {
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_MLBD_C19F8B58"), true);

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:502

    }

    lv_numberLength = StringLength(IntToString(lp_number));
    auto3340955B_ae = lv_numberLength;
    lv_i = 1;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:12775

    }

    if ((StringLength(StringWord(EventChatMessage(false), 3)) >= 1)) {
        PlayerApplySkin(StringToInt(StringWord(EventChatMessage(false), 3)), (StringWord(EventChatMessage(false), 2)), true);
    }

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:641

            if ((UnitAbilityCheck(lp_aIUnit, lv_itAbilLink, true) == true) && (UnitCheckAbilCmdState(lp_aIUnit, AbilityCommand(lv_itAbilLink, 0), c_cmdStateDisabled) == false)) {
                lv_itAbilTact = CatalogFieldValueGet(c_gameCatalogAbil, lv_itAbilLink, "TacticalAIFunc", lp_owner);
                if ((StringLength(lv_itAbilTact) > 0)) {
                    AIExecuteAbilTactical(lp_aIUnit, lv_itAbilTact, lp_nearByUnits, lv_itAbilLink, null);
                }

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:409

    // Variable Initialization
    lv_character = "";
    lv_stringlength = StringLength(lp_string);

    // Implementation

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:538

    // Variable Initialization
    lv_sentence = lp_sentence;
    lv_delimiterlength = StringLength(lp_delimiter);

    // Implementation

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:542

    // 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));
        lv_firstdelimiterindex = StringFind(lv_sentence, lp_delimiter, c_stringCase);

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:543

    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));
        lv_firstdelimiterindex = StringFind(lv_sentence, lp_delimiter, c_stringCase);
    }

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:546

        lv_firstdelimiterindex = StringFind(lv_sentence, lp_delimiter, c_stringCase);
    }
    if ((lv_firstdelimiterindex == -1) && (StringLength(lv_sentence) == 0)) {
        return null;
    }

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:563

    // Automatic Variable Declarations
    // Variable Initialization
    lv_sentencelength = StringLength(lp_sentence);
    lv_clippingwordlength = StringLength(lp_clippingWord);
    lv_clippingwordstart = StringFind(lp_sentence, lp_clippingWord, c_stringCase);

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:564

    // Variable Initialization
    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);

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:3015

    // Variable Initialization
    lv_chatstring = StringCase(EventChatMessage(false), false);
    lv_chatstringlength = StringLength(lv_chatstring);
    lv_chatcheatstring = "";
    lv_nextword = "";

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:3038


    lv_chatstring = libWCdr_gf_CliptoWord(lv_chatstring, lv_chatcheatstring);
    lv_chatstringlength = StringLength(lv_chatstring);
    lv_eventname = ("Event_ChatCheat_" + lv_chatcheatstring);
    while (true) {

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:3044

        if ((lv_nextword != null) && (lv_nextword != "")) {
            lv_chatstring = libWCdr_gf_CliptoWord(lv_chatstring, lv_nextword);
            lv_chatstringlength = StringLength(lv_chatstring);
            lv_numberofparameters += 1;
            DataTableSetString(false, TriggerEventParamName(lv_eventname, ("Param" + IntToString(lv_numberofparameters))), lv_nextword);