# String Containment
Grammar — s1 contains s2 at loc (sens|Sensitive/Insensitive to case)
Flags —Native
|Function
Checks if a string can be found within another string and returns true if present and false if not present.
# Arguments
string
— String 1string
— String 2int
<preset::String_Contain_Location> — Locationbool
<preset::String_Case_Sensitivity> — Sensitivity
Returns — bool
native bool StringContains(
string s1,
string s2,
int location,
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
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:19094
lv_roomname = StringWord(EventChatMessage(false), 2);
lv_name = StringWord(EventChatMessage(false), 3);
if ((StringContains(lv_roomname, "Armory", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomArmory;
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:19097
lv_room = ge_RoomID_RoomArmory;
}
else if ((StringContains(lv_roomname, "Bridge", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomBridge;
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:19100
lv_room = ge_RoomID_RoomBridge;
}
else if ((StringContains(lv_roomname, "Cantina", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomCantina;
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:19103
lv_room = ge_RoomID_RoomCantina;
}
else if ((StringContains(lv_roomname, "Char", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomChar;
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:19106
lv_room = ge_RoomID_RoomChar;
}
else if ((StringContains(lv_roomname, "Lab", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomLab;
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:19109
lv_room = ge_RoomID_RoomLab;
}
else if ((StringContains(lv_roomname, "MarSara", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomMarSara;
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:19094
lv_roomname = StringWord(EventChatMessage(false), 2);
lv_name = StringWord(EventChatMessage(false), 3);
if ((StringContains(lv_roomname, "Armory", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomArmory;
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:19097
lv_room = ge_RoomID_RoomArmory;
}
else if ((StringContains(lv_roomname, "Bridge", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomBridge;
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:19100
lv_room = ge_RoomID_RoomBridge;
}
else if ((StringContains(lv_roomname, "Cantina", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomCantina;
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:19103
lv_room = ge_RoomID_RoomCantina;
}
else if ((StringContains(lv_roomname, "Char", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomChar;
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:19106
lv_room = ge_RoomID_RoomChar;
}
else if ((StringContains(lv_roomname, "Lab", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomLab;
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:19109
lv_room = ge_RoomID_RoomLab;
}
else if ((StringContains(lv_roomname, "MarSara", c_stringAnywhere, c_stringNoCase) == true)) {
lv_room = ge_RoomID_RoomMarSara;
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignStoryLib.galaxy:530
// Automatic Variable Declarations
// Implementation
if ((libNtve_gf_DialogItemEditValue(libVCST_gv_pS_DebugStoryFilterEditBox, 1) != "") && (StringContains(lp_name, libNtve_gf_DialogItemEditValue(libVCST_gv_pS_DebugStoryFilterEditBox, 1), c_stringAnywhere, c_stringNoCase) == false)) {
return ;
}
mods/missionpacks/novacampaign.sc2mod — base.sc2data/LibNCST.galaxy:474
void libNCST_gf_NS_DebugStoryAddListItem (string lp_name, string lp_listInstance, string lp_listType) {
// Implementation
if ((libNtve_gf_DialogItemEditValue(libNCST_gv_nS_DebugStoryFilterEditBox, 1) != "") && (StringContains(lp_name, libNtve_gf_DialogItemEditValue(libNCST_gv_nS_DebugStoryFilterEditBox, 1), c_stringAnywhere, c_stringNoCase) == false)) {
return ;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:30110
for ( ; autoA7A5BD22_i <= CatalogEntryCount(c_gameCatalogReward) ; autoA7A5BD22_i += 1 ) {
lv_itReward = CatalogEntryGet(autoA7A5BD22_catalog, autoA7A5BD22_i);
if (((CatalogEntryScope(c_gameCatalogReward, lv_itReward) == "CRewardVoicePack") && (StringContains((lv_itReward), ("_" + (libCOOC_gf_ActiveCommanderForPlayer(1))), c_stringAnywhere, c_stringCase) == false))) {
if ((PlayerHasReward(1, lv_itReward) == true)) {
lv_rewardStringIDCombine = (((lv_itReward) + "_" + (libCOOC_gf_ActiveCommanderForPlayer(1))));
mods/warcoop/warclassic.sc2mod — base.sc2data/TriggerLibs/WarClassic.galaxy:82
entryset GAw3_EntrySetEmpty(){return "0 ";};
bool GAw3_EntrySetHasEntry(entryset set, string entry){
return StringContains(set,entry,c_stringAnywhere,c_stringCase);
}
entryset GAw3_EntrySetAdd(entryset set, string entry){
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicSystem.galaxy:123
for ( ; autoB7D8DFCC_i <= CatalogEntryCount(c_gameCatalogDataCollection) ; autoB7D8DFCC_i += 1 ) {
lv_itEntry = CatalogEntryGet(autoB7D8DFCC_catalog, autoB7D8DFCC_i);
if ((CatalogEntryScope(c_gameCatalogDataCollection, lv_itEntry) == "CDataCollectionAbil") && (StringContains((lv_itEntry), lv_raceToken, c_stringEnd, c_stringCase) == true)) {
lv_newLink = CatalogFieldValueGet(c_gameCatalogDataCollection, lv_itEntry, "TechInfoAbil", lp_player);
lv_oldLink = CatalogFieldValueGet(c_gameCatalogDataCollection, lv_itEntry, "TechInfoAbilReplaced", lp_player);
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:2105
for ( ; autoECD28B4C_i <= CatalogEntryCount(c_gameCatalogAbil) ; autoECD28B4C_i += 1 ) {
lv_itEntry = CatalogEntryGet(autoECD28B4C_catalog, autoECD28B4C_i);
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);
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:3723
// Conditions
if (testConds) {
if (!((StringContains(EventChatMessage(false), "thrall lives", c_stringAnywhere, c_stringNoCase) == true))) {
return false;
}