DIFF

class stringSource

ResourceName string

Part of Strings

Constants 1

Methods 32

proto native int ToInt()

Converts string to integer

Returns: int - Converted string.

string str = "56";
int i = str.ToInt();
Print(i);

>> i = 56
proto native int HexToInt()

Converts string to integer

Returns: int - Converted string.

string str = "0xFF";
int i = str.HexToInt();
Print(i);

>> i = 255
proto native float ToFloat()

Converts string to float

Returns: float - Converted string in float.

string str = "56.6";
float f = str.ToFloat();
Print(f);

>> f = 56.6
Referenced by ActionUnrestrainTargetCB.ObtainUnrestrainTime(), CameraToolsMenu.GetBlurValue(), CTEvent.GetEventTime()
Show 36 more, CTKeyframe.GetDOF(), CTKeyframe.GetFOV(), CTKeyframe.GetInterpTime(), DayZProfilesOptions.RegisterProfileOptionFloat(), DayZProfilesOptions.ResetOptionsFloat(), HudDebugWinCharStats.OnChange(), HudDebugWinHorticulture.OnClick(), Liquid.SetUpNutritionalProfile(), OptionSelectorSlider.OnChange(), PluginConfigHandler.ParseToValueFloat(), PluginDayZCreatureAIDebug.GUIAction_SetValue(), PluginDayZCreatureAIDebug.OnGUI_CommandsEdit(), PluginDayZInfectedDebug.CommandHandler(), PluginDayzPlayerDebug_Ctrl.CommandHandler(), PluginDayzPlayerDebug_Weapons.WeaponsStartAction(), PluginDiagMenu.InitTimeAccel(), PluginLocalProfile.GetParameterFloat(), PluginUniversalTemperatureSourceClient.CalcTemperatureFromTemperatureSource(), PluginUniversalTemperatureSourceClient.DrawDebugs(), PluginUniversalTemperatureSourceClient.ProcessUniversalTemperatureSources(), SceneEditorMenu.OnChange(), SceneEditorMenu.OnClick(), SceneEditorMenu.SaveProfileSpawnDistance(), ScriptConsoleCameraTab.IsValidEditboxValue(), ScriptConsoleCameraTab.UpdateValuesFromEditMode(), ScriptConsoleGeneralTab.TextToNumbersArray(), ScriptConsoleItemsTab.~ScriptConsoleItemsTab(), ScriptConsoleItemsTab.OnChange(), ScriptConsoleItemsTab.OnClick(), ScriptConsoleItemsTab.OnDoubleClick(), ScriptConsoleItemsTab.SaveProfileSpawnDistance(), ScriptConsoleVicinityTab.OnChange(), ScriptConsoleVicinityTab.RenderList(), ScriptConsoleWeatherTab.SaveWeatherPreset(), ScriptConsoleWeatherTab.UpdateSliderValues(), and UIPopupScriptPositionManager.OnClick()
vector BeautifiedToVector()

Convert beautified string into a vector

vec
beautified string

Returns: vector resulting vector

References Replace(), and ToVector()
proto native int ToAscii()

Converts string's first character to ASCII code

str
String for convert to ASCII code

Returns: ascii code int.

int ascii = "M".ToAscii();
Print(ascii);

>> ascii = 77
static proto string ToString(void var, bool type = false, bool name = false, bool quotes = true)

Return string representation of variable

proto string Substring(int start, int len)

Substring of 'str' from 'start' position 'len' number of characters

start
Position in str
len
Count of characters

Returns: string - Substring of str

string str = "Hello World";
string strSub = str.Substring(2, 5);
Print(strSub);

>> strSub = llo W
Referenced by ActionEnterLadder.ActionCondition(), ActionUnlockShippingContainer.TranslateLockSelectionIntoDoorIdx(), ActionUnmountBarbedWire.GetZoneSelection()
Show 46 more, AttachmentsOutOfReach.CreateAttachmentPosition(), Barrel_ColorBase.BleachClothes(), Barrel_ColorBase.ColourClothes(), CameraToolsMenu.OnClick(), CGame.GetModelName(), Chat.Add(), Chemlight_ColorBase.GetMaterialForDamageState(), DayZGame.SetMissionPath(), DayZTool.RunDayZBat(), DebugPrint.TrimDebugLog(), FireplaceIndoor.GetFirePointIndex(), GardenBase.GetSlotIndexByAttachmentSlot(), GardenBase.GetSlotIndexBySelection(), HudDebugWinCharDebug.Update(), MainMenuStats.GetValueString(), MiscGameplayFunctions.InsertAtPos(), MiscGameplayFunctions.SanitizeString(), OpenDirPlugin.Run(), OvenIndoor.GetFirePointIndex(), ParticleList.RegisterParticleByFullPath(), PartyTent.AnimateCamonetByOpeningSelection(), PartyTent.AnimateCamonetToggle(), PartyTent.HandleCamoNetAttachment(), PluginAdminLog.GetPlayerPrefix(), PluginConfigHandler.GetTextType(), PluginConfigHandler.ParseText(), PluginConfigHandler.ParseToValueArray(), PluginConfigHandler.ParseToValueString(), PluginConfigScene.GetSceneList(), PluginConfigViewer.ContainsFirstClass(), PluginConfigViewer.GetBaseClassPathCombined(), PluginConfigViewer.GetConfig(), PluginConfigViewer.GetConfigRecursive(), PluginConfigViewer.GetOnlyChildPath(), PluginLocalProfile.IsTextArray(), PluginLocalProfile.ParseTextToArray(), PluginLocalProfile.ParseTextToParameter(), ScriptConsoleConfigTab.OnClick(), ScriptConsoleGeneralTab.TextToNumbersArray(), ScriptConsoleItemsTab.PrepareFilters(), ServerBrowserFilterContainer.GetFilterOptionsPC(), ServerBrowserFilterContainer.LimitTextBoxCharacterCount(), ServerBrowserTab.IsPingInRange(), OldSet(), Split(), and SubstringInverted()
string SubstringInverted(string string_to_split, int position_start, int position_end)

Inverted SubString. This deletes everything in between position_start and position_end.

References Length(), and Substring()
proto string SubstringUtf8(int startChar, int len)

Substring of 'str' from 'startChar' position 'len' number of characters for UTF8 strings with multibyte chars

startChar
Position in str.
len
Count of characters

Returns: string - Substring of str with startChar character and len characters

string str = "こんにちは世界";
string strSub = str.SubstringUtf8(2, 4);
Print(strSub);

>> strSub = にちは世
proto int Replace(string sample, string replace)

Replace all occurrances of 'sample' in 'str' by 'replace'

sample
string to search in str
replace
string which replace sample in str

Returns: int - number of occurrances of 'sample' in 'str'

string test = "If the length of the C string in source is less than num, only the content up to the terminating null-character is copied.";
Print(test);
int count = test.Replace("the", "*");
Print(count);
Print(test);

>> string test = 'If the length of the C string in source is less than num, only the content up to the terminating null-character is copied.';
>> int count =   4
>> string test = 'If * length of * C string in source is less than num, only * content up to * terminating null-character is copied.'
proto int ToLower()

Changes string to lowercase. Returns length

Returns: int - Length of changed string

string str = "Hello World";
int i = str.ToLower();
Print(str);
Print(i);

>> str = hello world
>> i = 11
proto int ToUpper()

Changes string to uppercase. Returns length

Returns: int - Length of changed string

string str = "Hello World";
int i = str.ToUpper();
Print(str);
Print(i);

>> str = HELLO WORLD
>> i = 11
proto native int Length()

Returns length of string

Returns: int - Length of string

string str = "Hello World";
int i = str.Length();
Print(i);

>> i = 11
proto native int LengthUtf8()

Returns number of characters in UTF8 string

Returns: int - Number of characters in UTF8 string

string str = "こんにちは世界";
int i = str.LengthUtf8();
Print(i);

>> i = 7
proto native int Hash()

Returns hash of string

Returns: int - Hash of string

string str = "Hello World";
int hash = str.Hash();
Print(hash);
Referenced by ActionBase.Start(), AnimSoundLookupTableBank.GetActionTable(), AnimSoundLookupTableBank.GetImpactTable()
Show 33 more, AnimSoundLookupTableBank.GetStepTable(), AnimSoundObjectBuilderBank.GetBuilder(), ArrowManagerPlayer.AddArrowTypeToHash(), ArrowManagerPlayer.Save(), CatchingContextBase.SetupProbabilityArray(), CatchYieldBank.RegisterYieldItem(), CatchYieldBank.UnregisterYieldItem(), CrashBase.RequestSoundEvent(), CrashSoundSets.RegisterSoundSet(), DamageSystem.GetDamageDisplayName(), DayZCreatureAI.ProcessStepEvent(), DayZPlayerImplement.DayZPlayerImplement(), DayZPlayerImplement.OnStepEvent(), DayZPlayerImplement.ProcessVoiceEvent(), DayZPlayerTypeAttachmentSoundLookupTableImpl.DayZPlayerTypeAttachmentSoundLookupTableImpl(), DayZPlayerTypeStepSoundLookupTableImpl.DayZPlayerTypeStepSoundLookupTableImpl(), DayZPlayerTypeVoiceSoundLookupTableImpl.DayZPlayerTypeVoiceSoundLookupTableImpl(), EasterEgg.Capture(), EasterEgg.RegisterSoundSetMap(), EntityAI.InitDamageZoneDisplayNameMapping(), FoodStage.CanTransitionToFoodStageType(), FoodStage.FoodStage(), FoodStage.GetAllCookingPropertiesForStage(), FoodStage.GetCookingPropertyFromIndex(), FoodStage.GetNextFoodStageType(), FoodStage.GetNutritionPropertyFromIndex(), FoodStage.SetupFoodStageMapping(), FoodStage.SetupFoodStageTransitionMapping(), FoodStage.UpdateVisualsEx(), InventoryItem.ProcessImpactSoundEx(), PlayerStomach.RegisterItem(), ScriptConsole.GetWidgetCombinedHash(), and SoundLookupTable.LoadTable()
proto native int LastIndexOf(string sample)

Finds last 'sample' in 'str'. Returns -1 when not found

sample
string Finding string

Returns: int - Returns position where sample starts, or -1 when sample not found

string str = "Hello World";
Print( str.IndexOf( "l" ) );

>> 9
proto native int IndexOfFrom(int start, string sample)

Finds 'sample' in 'str' from 'start' position. Returns -1 when not found

start
int Start from position
sample
string Finding string expression

Returns: int - Length of string s

string str = "Hello World";
Print( str.IndexOfFrom( 3, "H" ) );
Print( str.IndexOfFrom( 3, "W" ) );
Print( str.IndexOfFrom( 3, "Q" ) );

>> -1
>> 6
>> -1
bool Contains(string sample)

Returns true if sample is substring of string

sample
string Finding string expression

Returns: bool true if sample is substring of string

string str = "Hello World";
Print( str.IndexOfFrom( 3, "Hello" ) );
Print( str.IndexOfFrom( 3, "Mexico" ) );

>> true
>> false
References IndexOf()
Referenced by CreateMission(), ActionBase.IsInReach(), ActionCreateIndoorFireplace.ActionCondition()
Show 46 more, ActionCreateIndoorOven.ActionCondition(), ActionDetachFromTarget_SpecificSlotsCategory.FindSlotIdToDetach(), ActionPlaceFireplaceIndoor.ActionCondition(), ActionPlaceOvenIndoor.ActionCondition(), ActionTargetsCursor.GetOnScreenPosition(), ActionUnlockShippingContainer.TranslateLockSelectionIntoDoorIdx(), AreaDamageComponentRaycasted.GetFallbackHitZone(), AttachmentsOutOfReach.CreateAttachmentPosition(), BaseBuildingBase.EEHealthLevelChanged(), BaseBuildingBase.FullyBuild(), BaseBuildingBase.HandleItemFalling(), CheckLocalisationPlugin.FindTexts(), CivilianSedan.CanDisplayAttachmentCategory(), Construction.DropNonUsableMaterialsServer(), Debug.GetFiltredConfigClasses(), Edible_Base.EEItemLocationChanged(), FireplaceBase.IsEntityOnWaterSurface(), Hatchback_02.CanDisplayAttachmentCategory(), Land_WarheadStorage_PowerStation.OnAnimationPhaseStarted(), ObjectSpawnerHandler.SpawnObject(), ObjectSpawnerHandler.ValidatePath(), Offroad_02.CanDisplayAttachmentCategory(), OffroadHatchback.CanDisplayAttachmentCategory(), PluginConfigHandler.ParseToValueBool(), PluginDayZCreatureAIDebug.GUIAction_SetValue(), PluginDayzPlayerDebug.DisplayActions(), PluginDeveloper.SpawnFromClipboard(), SceneEditorMenu.GetFiltredConfigClasses(), SceneEditorMenu.GetFiltredSceneObjects(), ScriptConsoleConfigTab.FindInHierarchy(), ScriptConsoleConfigTab.RenderVariables(), ScriptConsoleGeneralTab.TextToNumbersArray(), ScriptConsoleItemsTab.ChangeFilter(), ScriptConsoleItemsTab.PreprocessFilterText(), ScriptConsoleSoundsTab.ChangeFilter(), ScriptConsoleSoundsTab.ScriptConsoleSoundsTab(), Sedan_02.CanDisplayAttachmentCategory(), SpookyEventBase.GetMatchingSurfacePos(), StaticGUIUtils.VerifyIconImageString(), TentBase.ToggleAnimation(), TrapBase.GetClosestCarWheel(), UIPopupScriptConfigs.FindInHierarchy(), Watchtower.CanDisplayAttachmentCategory(), Watchtower.CanDisplayAttachmentSlot(), Watchtower.CheckLevelVerticalDistance(), and Watchtower.CheckSlotVerticalDistance()
proto int TrimInPlace()

Removes leading and trailing whitespaces in string. Returns length

Returns: int - Count of chars

string str = " Hello World ";
int i = str.TrimInPlace();
Print(str);
Print(i);

>> str = 'Hello World'
>> i = 11
proto int ParseStringEx(out string token)

Parses one token from input string. Result is put into token string, and type of token is returned. Input string is left-truncated by the resulting token length.

out token
string Founded string token

Returns: int Type of token \verbatim Token types: 0 - error, no token 1 - defined token (special characters etc. . / * ) 2 - quoted string. Quotes are removed -> TODO 3 - alphabetic string 4 - number 5 - end of line -> TODO \endverbatim

string input = "Hello*World";
string token1;
string token2;

int result1 = input.ParseStringEx(token1);
int result2 = input.ParseStringEx(token2);

Print( "Token1 = '" + token1 + "' Type = " + result1.ToString() ) );
Print( "Token2 = '" + token2 + "' Type = " + result2.ToString() ) );

>> 'Toke1 = 'Hello' Type = 3'
>> 'Toke1 = '*' Type = 1'
proto int ParseString(out string tokens[])

Parses string into array of tokens returns number of tokens

out tokens
array[] Parsed string in array

Returns: int Number of tokens

string token[2];
string str = "Hello World";
int result = str.ParseString(token);

for (int i = 0; i < 2; i++)
{
	Print(token[i]);
}

>> 'Hello'
>> 'World'
void Split(string sample, out array<string> output)

Splits string into array of strings separated by 'sample'

sample
string Strings separator

Returns: TStringArray Array with strings

string example = "The quick brown fox jumps over the lazy dog";
TStringArray strs = new TStringArray;
example.Split(" ", strs);

for (int i = 0; i < strs.Count(); i++)
{
	Print(strs.Get(i));
}

>> 'The'
>> 'quick'
>> 'brown'
>> 'fox'
>> 'jumps'
>> 'over'
>> 'the'
>> 'lazy'
>> 'dog'
References IndexOfFrom(), array.Insert(), Length()
Show 1 more, Substring()
Referenced by CCTWaterSurface.CCTWaterSurface(), DayZGame.GetLastVisitedServer(), DayZPlayerImplement.ProcessAttachmentEvent()
Show 33 more, GetServersResultRow.GetIP(), InputUtils.GetImagesetAndIconFromInputAction(), ItemManager.DeserializeDefaultHeaderOpenStates(), ItemManager.DeserializeDefaultOpenStates(), JsonObject.AddString(), Land_WarheadStorage_Bunker_Facility.OnSpawnByObjectSpawner(), Land_WarheadStorage_Main.OnSpawnByObjectSpawner(), PluginConfigHandler.ParseToValueArray(), PluginConfigViewer.GetBaseClasses(), PluginConfigViewer.GetConfig(), PluginDayZCreatureAIDebug.OnGUI_AnimEvents(), PluginDayzPlayerDebug.DisplayActions(), PluginDeveloper.SpawnFromClipboard(), PluginDiagMenu.InitTimeAccel(), PluginLocalProfile.GetParameterString(), PluginLocalProfile.GetSubParameterInArrayString(), PluginLocalProfile.ParseTextToArray(), ScriptConsoleConfigTab.FindInHierarchy(), ScriptConsoleConfigTab.OnClick(), ScriptConsoleConfigTab.RenderVariables(), ScriptConsoleItemsTab.PrepareFilters(), ScriptConsoleSoundsTab.PrepareFilters(), ScriptConsoleWeatherTab.PasteValues(), ServerBrowserDetailsContainer.SetTimeIcon(), ServerBrowserEntry.SetTime(), ServerBrowserFavoritesTabConsolePages.LoadExtraEntries(), ServerBrowserFilterContainer.GenerateValidIP(), ServerBrowserMenuNew.AddFavoritesToFilter(), ServerBrowserMenuNew.LoadFavoriteServers(), ServerBrowserTabPc.GetTimeOfDayEnum(), UIPopupScriptConfigs.FindInHierarchy(), UniversalTemperatureSourceDebug.ParseData(), and UniversalTemperatureSourceDebug.ParseKeyPairs()
static string Join(string separator, notnull TStringArray tokens)
proto void Set(int index, string input)

Sets the n-th character in string with the input, replacing previous value

index
index to be replaced
input
single non-terminated character value to replace with
WarningVME When index less than 0 or greater than string length
Warning(Diag) VME When string is empty or greater than length of 1 (Retail) Calls 'string.Insert' except it replaces only the initial character
string str = "Hello World";
str[4] = "O";
Print( str );

>> 'HellO World'
string str = "Hello World";
str[6] = "Test ";
Print( str );

>> 'Hello Test orld'
void OldSet(int n, string _value)DIAG_DEVELOPER

Do not use. Re-implemented for verification of new function due to design of previous function allowing for unexpected behavior that modders may depend on.

string str = "Hello World";
str.OldSet(6, "Test ");
Print( str );

>> 'Hello Test orld'

See also: string.Set, warnings, for, handling, existing, mods, in, Retail

References Length(), and Substring()
proto void Insert(int index, string input)

Inserts a string into the n-th index, increasing the string length by the size of the input

index
index to insert at
input
string value to insert with
WarningVME When index less than 0 or greater than string length
WarningVME When string is empty
string str = "Hello World";
str.Insert(6, "Test ");
Print( str );

>> 'Hello Test World'
static proto string Format(string fmt, void param1 = NULL, void param2 = NULL, void param3 = NULL, void param4 = NULL, void param5 = NULL, void param6 = NULL, void param7 = NULL, void param8 = NULL, void param9 = NULL)

Gets n-th character from string

index
character index

Returns: string character on index-th position in string

int a = 5;
float b = 5.99;
string c = "beta";
string 	test = string.Format("Ahoj %1 = %3 , %2", a, b, c);
Print(test);
>> 'Ahoj 5 = 'beta' , 5.99'