# String With Search Replacement

Grammarstring with up to count findString replaced by replaceString (sensitivity|Sensitive/Insensitive to case)
FlagsNative | Function

Replaces one or more occcurrences of a substring inside a string.

# Arguments

  • string — String
  • string — Find String
  • string — Replace String
  • int — Count
  • bool<preset::String_Case_Sensitivity> — Sensitivity

Returns — string

native string StringReplaceWord(
	string s,
	string word,
	string replace,
	int maxCount,
	bool caseSens,
);

Category: String / Substrings

# Examples

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


    lv_offsetString = CatalogFieldValueGet(c_gameCatalogMap, (lp_nextMap), "LoadingTextOffset", c_playerAny);
    lv_offsetString = StringReplaceWord(lv_offsetString, ",", " ", 1, c_stringCase);
    lv_waitForKey = !(libSwaC_gf_StoryMapTypeCheck(lp_nextMap, c_mapKindStory));
    UISetNextLoadingScreenImageScale(c_scaleAspect);

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


    lv_offsetString = CatalogFieldValueGet(c_gameCatalogMap, (lp_nextMap), "LoadingTextOffset", c_playerAny);
    lv_offsetString = StringReplaceWord(lv_offsetString, ",", " ", 1, c_stringCase);
    lv_waitForKey = !(libVoiC_gf_PC_CampaignMapTypeCheck(lp_nextMap, c_mapKindStory));
    UISetNextLoadingScreenImageScale(c_scaleAspect);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:1102


    libVCMI_gv_pM_MissionCheat_ArrayCount += 1;
    libVCMI_gv_pM_MissionCheat_Cheats[libVCMI_gv_pM_MissionCheat_ArrayCount].lv_titleString = StringReplaceWord(lp_command, " ", "", c_stringReplaceAll, c_stringCase);
    libVCMI_gv_pM_MissionCheat_Cheats[libVCMI_gv_pM_MissionCheat_ArrayCount].lv_description = StringToText(lp_description);
    libVCMI_gv_pM_MissionCheat_Cheats[libVCMI_gv_pM_MissionCheat_ArrayCount].lv_trigger = lp_trigger;

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


    // Implementation
    lv_animationString = StringReplaceWord(lp_animation, " ", ",", 0, c_stringCase);
    lv_fullMatchFlag = (lp_flags & c_animFlagFullMatch) == c_animFlagFullMatch;
    lv_playForeverFlag = (lp_flags & c_animFlagPlayForever) == c_animFlagPlayForever;

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


    // Implementation
    lv_animationString = StringReplaceWord(lp_animation, " ", ",", 0, c_stringCase);
    lv_fullMatchFlag = (lp_flags & c_animFlagFullMatch) == c_animFlagFullMatch;
    lv_playForeverFlag = (lp_flags & c_animFlagPlayForever) == c_animFlagPlayForever;

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


    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_actorMessageString = ("AnimGroupApply " + lv_propertiesString);
    ActorSend(lp_target, (lv_actorMessageString));

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


    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_blendInString = (lv_propertiesString + "," + StringReplaceWord(lp_blendInAnimation, " ", ",", 0, c_stringCase));
    lv_blendOutString = (lv_propertiesString + "," + StringReplaceWord(lp_blendOutAnimation, " ", ",", 0, c_stringCase));

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

    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_blendInString = (lv_propertiesString + "," + StringReplaceWord(lp_blendInAnimation, " ", ",", 0, c_stringCase));
    lv_blendOutString = (lv_propertiesString + "," + StringReplaceWord(lp_blendOutAnimation, " ", ",", 0, c_stringCase));
    lv_actorMessageString = ("AnimGroupApply " + lv_propertiesString + " " + lv_blendInString + " " + lv_blendOutString);

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

    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_blendInString = (lv_propertiesString + "," + StringReplaceWord(lp_blendInAnimation, " ", ",", 0, c_stringCase));
    lv_blendOutString = (lv_propertiesString + "," + StringReplaceWord(lp_blendOutAnimation, " ", ",", 0, c_stringCase));
    lv_actorMessageString = ("AnimGroupApply " + lv_propertiesString + " " + lv_blendInString + " " + lv_blendOutString);
    ActorSend(lp_target, (lv_actorMessageString));

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


    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_actorMessageString = ("AnimGroupRemove " + lv_propertiesString);
    ActorSend(lp_target, (lv_actorMessageString));

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


    // Implementation
    lv_newTargetFilterString = StringReplaceWord(lp_targetFilterString, ",", " ", 0, c_stringCase);
    lv_newTargetFilterString = StringReplaceWord(lv_newTargetFilterString, ";", " DIV ", 0, c_stringCase);
    lv_wordOfFilterString = StringWord(lv_newTargetFilterString, 1);

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

    // Implementation
    lv_newTargetFilterString = StringReplaceWord(lp_targetFilterString, ",", " ", 0, c_stringCase);
    lv_newTargetFilterString = StringReplaceWord(lv_newTargetFilterString, ";", " DIV ", 0, c_stringCase);
    lv_wordOfFilterString = StringWord(lv_newTargetFilterString, 1);
    while ((lv_wordOfFilterString != "")) {

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


    // Implementation
    lv_animationString = StringReplaceWord(lp_animation, " ", ",", 0, c_stringCase);
    lv_fullMatchFlag = (lp_flags & c_animFlagFullMatch) == c_animFlagFullMatch;
    lv_playForeverFlag = (lp_flags & c_animFlagPlayForever) == c_animFlagPlayForever;

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


    // Implementation
    lv_animationString = StringReplaceWord(lp_animation, " ", ",", 0, c_stringCase);
    lv_fullMatchFlag = (lp_flags & c_animFlagFullMatch) == c_animFlagFullMatch;
    lv_playForeverFlag = (lp_flags & c_animFlagPlayForever) == c_animFlagPlayForever;

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


    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_actorMessageString = ("AnimGroupApply " + lv_propertiesString);
    ActorSend(lp_target, (lv_actorMessageString));

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


    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_blendInString = (lv_propertiesString + "," + StringReplaceWord(lp_blendInAnimation, " ", ",", 0, c_stringCase));
    lv_blendOutString = (lv_propertiesString + "," + StringReplaceWord(lp_blendOutAnimation, " ", ",", 0, c_stringCase));

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

    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_blendInString = (lv_propertiesString + "," + StringReplaceWord(lp_blendInAnimation, " ", ",", 0, c_stringCase));
    lv_blendOutString = (lv_propertiesString + "," + StringReplaceWord(lp_blendOutAnimation, " ", ",", 0, c_stringCase));
    lv_actorMessageString = ("AnimGroupApply " + lv_propertiesString + " " + lv_blendInString + " " + lv_blendOutString);

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

    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_blendInString = (lv_propertiesString + "," + StringReplaceWord(lp_blendInAnimation, " ", ",", 0, c_stringCase));
    lv_blendOutString = (lv_propertiesString + "," + StringReplaceWord(lp_blendOutAnimation, " ", ",", 0, c_stringCase));
    lv_actorMessageString = ("AnimGroupApply " + lv_propertiesString + " " + lv_blendInString + " " + lv_blendOutString);
    ActorSend(lp_target, (lv_actorMessageString));

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


    // Implementation
    lv_propertiesString = StringReplaceWord(lp_prop, " ", ",", 0, c_stringCase);
    lv_actorMessageString = ("AnimGroupRemove " + lv_propertiesString);
    ActorSend(lp_target, (lv_actorMessageString));

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


    // Implementation
    lv_newTargetFilterString = StringReplaceWord(lp_targetFilterString, ",", " ", 0, c_stringCase);
    lv_newTargetFilterString = StringReplaceWord(lv_newTargetFilterString, ";", " DIV ", 0, c_stringCase);
    lv_wordOfFilterString = StringWord(lv_newTargetFilterString, 1);

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

    // Implementation
    lv_newTargetFilterString = StringReplaceWord(lp_targetFilterString, ",", " ", 0, c_stringCase);
    lv_newTargetFilterString = StringReplaceWord(lv_newTargetFilterString, ";", " DIV ", 0, c_stringCase);
    lv_wordOfFilterString = StringWord(lv_newTargetFilterString, 1);
    while ((lv_wordOfFilterString != "")) {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:5835

            if (((lv_field == "InitialOffset") || (lv_field == "ExpireOffset") || (lv_field == "FinalOffset") || (lv_field == "PeriodicOffsetArray[0]") || (lv_field == "PeriodicOffsetArray[1]"))) {
                lv_offsetString = CatalogFieldValueGet(lv_catalog, lv_entry, lv_field, lp_player);
                lv_offsetString = StringReplaceWord(lv_offsetString, ",", " ", c_stringReplaceAll, c_stringCase);
                lv_xOffset = StringWord(lv_offsetString, 1);
                lv_yOffset = StringWord(lv_offsetString, 2);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:5968

            if (((lv_field == "InitialOffset") || (lv_field == "ExpireOffset") || (lv_field == "FinalOffset") || (lv_field == "PeriodicOffsetArray[0]"))) {
                lv_offsetString = CatalogFieldValueGet(lv_catalog, lv_entry, lv_field, lv_player);
                lv_offsetString = StringReplaceWord(lv_offsetString, ",", " ", c_stringReplaceAll, c_stringCase);
                lv_xOffset = StringWord(lv_offsetString, 1);
                lv_yOffset = StringWord(lv_offsetString, 2);

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


    lv_chatString = StringWord(EventChatMessage(false), 2);
    lv_hero = StringReplaceWord(lv_chatString, "Hero", "", c_stringReplaceAll, c_stringNoCase);
    lv_heroIndex = libCore_gf_GetIndexFromHero((lv_hero));
    lv_player = StringToInt(StringWord(EventChatMessage(false), 3));

mods/heromods/alarak.stormmodbase.stormdata/LibHALA.galaxy:798

    lv_player = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);
    lv_effectString = (EventPlayerEffectUsed());
    lv_searchNumber = StringReplaceWord(lv_effectString, "AlarakLightningSurgeSearch", "", c_stringReplaceAll, c_stringCase);
    lv_finalNumberReal = (StringToFixed(lv_searchNumber) * 0.12);
    lv_finalNumberString = FixedToString(lv_finalNumberReal, 3);

mods/missionpacks/campaigncommon.sc2modbase.sc2data/LibComC.galaxy:3024


    lv_offsetString = CatalogFieldValueGet(c_gameCatalogMap, (lp_nextMap), "LoadingTextOffset", c_playerAny);
    lv_offsetString = StringReplaceWord(lv_offsetString, ",", " ", 1, c_stringCase);
    lv_waitForKey = !(libComC_gf_CampaignMapTypeCheck(lp_nextMap, c_mapKindStory));
    UISetNextLoadingScreenImageScale(c_scaleAspect);

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNCMI.galaxy:2113


    libNCMI_gv_NM_MissionCheat_ArrayCount += 1;
    libNCMI_gv_NM_MissionCheat_Cheats[libNCMI_gv_NM_MissionCheat_ArrayCount].lv_titleString = StringReplaceWord(lp_command, " ", "", c_stringReplaceAll, c_stringCase);
    libNCMI_gv_NM_MissionCheat_Cheats[libNCMI_gv_NM_MissionCheat_ArrayCount].lv_description = StringToText(lp_description);
    libNCMI_gv_NM_MissionCheat_Cheats[libNCMI_gv_NM_MissionCheat_ArrayCount].lv_trigger = lp_trigger;

mods/voidprologue.sc2modbase.sc2data/LibA3DDD02B.galaxy:6340


    lv_offsetString = CatalogFieldValueGet(c_gameCatalogMap, (lp_nextMap), "LoadingTextOffset", c_playerAny);
    lv_offsetString = StringReplaceWord(lv_offsetString, ",", " ", 1, c_stringCase);
    lv_waitForKey = !(libA3DDD02B_gf_StoryMapTypeCheck(lp_nextMap, c_mapKindStory));
    UISetNextLoadingScreenImageScale(c_scaleAspect);

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:91

        {
            head=StringWord(set,1);
            body=StringReplaceWord(set,head,"",1,c_stringCase);
            body=body+entry+" ";
            c=StringToInt(head);

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:104

    string body;
    head=StringWord(set,1);
    body=StringReplaceWord(set,head,"",1,c_stringCase);
    body=body+entry+" ";
    c=StringToInt(head);

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:118

        {
            head=StringWord(set,1);
            body=StringReplaceWord(set,head,"",1,c_stringCase);
            body=StringReplaceWord(body,entry+" ","",1,c_stringCase);
            c=StringToInt(head);

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:119

            head=StringWord(set,1);
            body=StringReplaceWord(set,head,"",1,c_stringCase);
            body=StringReplaceWord(body,entry+" ","",1,c_stringCase);
            c=StringToInt(head);
            c-=1;

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

        if ((StringContains((lv_itEntry), lv_raceToken, c_stringEnd, c_stringCase) == true)) {
            lv_newLink = (lv_itEntry);
            lv_oldLink = StringReplaceWord(lv_newLink, lv_raceToken, "", c_stringReplaceAll, c_stringCase);
            if ((CatalogEntryIsValid(c_gameCatalogAbil, lv_oldLink) == true)) {
                CatalogLinkReplace(lp_player, c_gameCatalogAbil, lv_oldLink, lv_newLink);