Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Strings

Структуры данных

class  string
 

Функции

proto native int ToInt ()
 Converts string to integer.
 
proto native int HexToInt ()
 Converts string to integer.
 
proto native float ToFloat ()
 Converts string to float.
 
proto vector ToVector ()
 Returns a vector from a string.
 
vector BeautifiedToVector ()
 Convert beautified string into a vector.
 
proto native int ToAscii ()
 Converts string's first character to ASCII code.
 
proto native ToType ()
 Returns internal type representation. Can be used in runtime, or cached in variables and used for faster inheritance checking.
 
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.
 
string SubstringInverted (string string_to_split, int position_start, int position_end)
 Inverted SubString. This deletes everything in between position_start and position_end.
 
proto string SubstringUtf8 (int startChar, int len)
 Substring of 'str' from 'startChar' position 'len' number of characters for UTF8 strings with multibyte chars.
 
proto int Replace (string sample, string replace)
 Replace all occurrances of 'sample' in 'str' by 'replace'.
 
proto int ToLower ()
 Changes string to lowercase. Returns length.
 
proto int ToUpper ()
 Changes string to uppercase. Returns length.
 
proto native int Length ()
 Returns length of string.
 
proto native int LengthUtf8 ()
 Returns number of characters in UTF8 string.
 
proto native int Hash ()
 Returns hash of string.
 
proto native int IndexOf (string sample)
 Finds 'sample' in 'str'. Returns -1 when not found.
 
proto native int LastIndexOf (string sample)
 Finds last 'sample' in 'str'. Returns -1 when not found.
 
proto native int IndexOfFrom (int start, string sample)
 Finds 'sample' in 'str' from 'start' position. Returns -1 when not found.
 
bool Contains (string sample)
 Returns true if sample is substring of string.
 
proto string Trim ()
 Returns trimmed string with removed leading and trailing whitespaces.
 
proto int TrimInPlace ()
 Removes leading and trailing whitespaces in string. Returns length.
 
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.
 
proto int ParseString (out string tokens[])
 Parses string into array of tokens returns number of tokens.
 
void Split (string sample, out array< string > output)
 Splits string into array of strings separated by 'sample'.
 
static string Join (string separator, notnull TStringArray tokens)
 
proto string Get (int index)
 Gets n-th character from string.
 
proto void Set (int index, string input)
 Sets the n-th character in string with the input, replacing previous value.
 
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.
 
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.
 

Переменные

static const string Empty
 

Подробное описание

Функции

◆ BeautifiedToVector()

vector BeautifiedToVector ( )
inlineprivate

Convert beautified string into a vector.

Аргументы
vecbeautified string
Возвращает
vector resulting vector
68 {
69 string copy = value;
70 copy.Replace("<", "");
71 copy.Replace(">", "");
72 copy.Replace(",", " ");
73 return copy.ToVector();
74 }
Definition EntityAI.c:95

Перекрестные ссылки string::Replace() и string::ToVector().

Используется в ScriptConsoleGeneralTab::OnClick().

◆ Contains()

bool Contains ( string sample)
inlineprivate

Returns true if sample is substring of string.

Аргументы
samplestring Finding string expression
Возвращает
bool true if sample is substring of string
string str = "Hello World";
Print( str.IndexOfFrom( 3, "Hello" ) );
Print( str.IndexOfFrom( 3, "Mexico" ) );
>> true
>> false
proto void Print(void var)
Prints content of variable to console/log.
287 {
288 return value.IndexOf(sample) != -1;
289 }

Используется в BaseBuildingBase::CheckLevelVerticalDistance(), AttachmentsOutOfReach::CreateAttachmentPosition(), CreateMission(), ItemBase::ToggleAnimation() и ObjectSpawnerHandler::ValidatePath().

◆ Format()

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 )
staticprivate

Gets n-th character from string.

Аргументы
indexcharacter index
Возвращает
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);
>> 'Ahoj 5 = 'beta' , 5.99'

Используется в Add(), ItemBase::EEItemAttached(), ItemBase::EEItemDetached(), FullTimeData::FormatedWithZero(), GetAdminLogMessage(), ErrorProperties::GetClientMessage(), GetColorString(), GetComponentNamesFromDamageZone(), GetDamageZoneMap(), TentBase::GetMaterialPath(), ErrorProperties::GetServerMessage(), ErrorHandlerModule::GetSimpleMessage(), array::GetTestEx(), Entity::InitDamageZoneDisplayNameMapping(), LandMineTrap(), ParticleList::RegisterParticle(), TFModule::Result() и TripwireTrap().

◆ Get()

proto string Get ( int index)
private

Gets n-th character from string.

Аргументы
indexcharacter index
Возвращает
string character on index-th position in string
Предупреждения
VME When index less than 0 or greater than string length
string str = "Hello World";
Print( str[4] ); // Print( str.Get(4) );
>> 'o'

Используется в FireworksLauncherClientEvent::FireworksLauncherClientEvent(), ScriptedWidgetEventHandler::Highlight() и ScriptedWidgetEventHandler::Select().

◆ Hash()

proto native int Hash ( )
private

Returns hash of string.

Возвращает
int - Hash of string
string str = "Hello World";
int hash = str.Hash();

Используется в Capture(), DayZPlayer::OnStepEvent() и ArrowManagerPlayer::Save().

◆ HexToInt()

proto native int HexToInt ( )
private

Converts string to integer.

Возвращает
int - Converted string.
string str = "0xFF";
int i = str.HexToInt();
>> i = 255

◆ IndexOf()

proto native int IndexOf ( string sample)
private

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

Аргументы
samplestring Finding string
Возвращает
int - Returns position where sample starts, or -1 when sample not found
string str = "Hello World";
Print( str.IndexOf( "H" ) );
Print( str.IndexOf( "W" ) );
Print( str.IndexOf( "Q" ) );
>> 0
>> 6
>> -1

Используется в PluginBase::GetPlayerPrefix().

◆ IndexOfFrom()

proto native int IndexOfFrom ( int start,
string sample )
private

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

Аргументы
startint Start from position
samplestring Finding string expression
Возвращает
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

Используется в ActionUnmountBarbedWire::ActionCondition() и CGame::SetMissionPath().

◆ Insert()

proto void Insert ( int index,
string input )
private

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

Аргументы
indexindex to insert at
inputstring value to insert with
Предупреждения
VME When index less than 0 or greater than string length
VME When string is empty
string str = "Hello World";
str.Insert(6, "Test ");
>> 'Hello Test World'

Используется в HFSMBase< Class FSMStateBase, Class FSMEventBase, Class FSMActionBase, Class FSMGuardBase >::GetHierarchyPath(), ScriptedWidgetEventHandler::LoadEntries() и string::Split().

◆ Join()

static string Join ( string separator,
notnull TStringArray tokens )
inlinestaticprivate
425 {
426 string output;
427 foreach (int i, string s: tokens)
428 {
429 if (i != 0)
430 output += separator;
431 output += s;
432 }
433 return output;
434 }

◆ LastIndexOf()

proto native int LastIndexOf ( string sample)
private

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

Аргументы
samplestring Finding string
Возвращает
int - Returns position where sample starts, or -1 when sample not found
string str = "Hello World";
Print( str.IndexOf( "l" ) );
>> 9

◆ Length()

◆ LengthUtf8()

proto native int LengthUtf8 ( )
private

Returns number of characters in UTF8 string.

Возвращает
int - Number of characters in UTF8 string
string str = "こんにちは世界";
int i = str.LengthUtf8();
>> i = 7

◆ ParseString()

proto int ParseString ( out string tokens[])
private

Parses string into array of tokens returns number of tokens.

Аргументы
[out]tokensarray[] Parsed string in array
Возвращает
int Number of tokens
string token[2];
string str = "Hello World";
int result = str.ParseString(token);
for (int i = 0; i < 2; i++)
{
}
>> 'Hello'
>> 'World'

◆ ParseStringEx()

proto int ParseStringEx ( out string token)
private

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]tokenstring Founded string token
Возвращает
int Type of token
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
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'

◆ Replace()

proto int Replace ( string sample,
string replace )
private

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

Аргументы
samplestring to search in str
replacestring which replace sample in str
Возвращает
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.";
int count = test.Replace("the", "*");
>> 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.'

Используется в string::BeautifiedToVector() и ResavePlugin::RunCommandline().

◆ Set()

proto void Set ( int index,
string input )
private

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

Аргументы
indexindex to be replaced
inputsingle non-terminated character value to replace with
Предупреждения
VME When index less than 0 or greater than string length
(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";
>> 'HellO World'
string str = "Hello World";
str[6] = "Test ";
>> 'Hello Test orld'

◆ Split()

void Split ( string sample,
out array< string > output )
inlineprivate

Splits string into array of strings separated by 'sample'.

Аргументы
samplestring Strings separator
Возвращает
TStringArray Array with strings
string example = "The quick brown fox jumps over the lazy dog";
example.Split(" ", strs);
for (int i = 0; i < strs.Count(); i++)
{
Print(strs.Get(i));
}
>> 'The'
>> 'quick'
>> 'brown'
>> 'fox'
>> 'jumps'
>> 'over'
>> 'the'
>> 'lazy'
>> 'dog'
array< string > TStringArray
Definition EnScript.c:685
397 {
398 int txt_len = 0;
399 int sep_pos = -1;
400 int nxt_sep_pos = 0;
401 string text = "";
402
403 bool line_end = false;
404 while (line_end == false)
405 {
406 sep_pos = sep_pos + txt_len + 1;
407 nxt_sep_pos = value.IndexOfFrom(sep_pos, sample);
408 if ( nxt_sep_pos == -1 )
409 {
410 nxt_sep_pos = value.Length();
411 line_end = true;
412 }
413
415 if ( txt_len > 0 )
416 {
417 text = value.Substring(sep_pos, txt_len);
418 output.Insert(text);
419 }
420 }
421 }

Перекрестные ссылки string::Insert() и string::Substring().

Используется в ScriptConsoleConfigTab::OnClick() и ParseData().

◆ Substring()

proto string Substring ( int start,
int len )
private

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

Аргументы
startPosition in str
lenCount of characters
Возвращает
string - Substring of str
string str = "Hello World";
string strSub = str.Substring(2, 5);
>> strSub = llo W

Используется в ActionUnmountBarbedWire::ActionCondition(), PluginBase::GetPlayerPrefix(), CGame::SetMissionPath(), string::Split() и string::SubstringInverted().

◆ SubstringInverted()

string SubstringInverted ( string string_to_split,
int position_start,
int position_end )
inlineprivate

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

117 {
118 string first_half = string_to_split.Substring(0, position_start);
119 string second_half = string_to_split.Substring( position_end, string_to_split.Length() - position_end );
120 string result = first_half + second_half;
121 return result;
122 }

Перекрестные ссылки string::Length() и string::Substring().

◆ SubstringUtf8()

proto string SubstringUtf8 ( int startChar,
int len )
private

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

Аргументы
startCharPosition in str.
lenCount of characters
Возвращает
string - Substring of str with startChar character and len characters
string str = "こんにちは世界";
string strSub = str.SubstringUtf8(2, 4);

◆ ToAscii()

proto native int ToAscii ( )
private

Converts string's first character to ASCII code.

Аргументы
strString for convert to ASCII code
Возвращает
ascii code int.
int ascii = "M".ToAscii();
>> ascii = 77

◆ ToFloat()

proto native float ToFloat ( )
private

Converts string to float.

Возвращает
float - Converted string in float.
string str = "56.6";
float f = str.ToFloat();
>> f = 56.6

◆ ToInt()

proto native int ToInt ( )
private

Converts string to integer.

Возвращает
int - Converted string.
string str = "56";
int i = str.ToInt();
>> i = 56

◆ ToLower()

proto int ToLower ( )
private

Changes string to lowercase. Returns length.

Возвращает
int - Length of changed string
string str = "Hello World";
int i = str.ToLower();
>> i = 11

Используется в AttachmentsOutOfReach::CreateAttachmentPosition() и DynamicMusicPlayerRegistry::PreloadData().

◆ ToString()

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

Return string representation of variable.

Используется в PrintElements() и ToStringLen().

◆ ToType()

proto native ToType ( )
private

Returns internal type representation. Can be used in runtime, or cached in variables and used for faster inheritance checking.

Возвращает
typename Type of class
???

Используется в CreateParticle(), ImpactMaterials::EvaluateImpactEffect(), PluginBase::GetModuleType(), EffectArea::GetRequesterIndex() и ImpactMaterials::RegisterSurface().

◆ ToUpper()

proto int ToUpper ( )
private

Changes string to uppercase. Returns length.

Возвращает
int - Length of changed string
string str = "Hello World";
int i = str.ToUpper();
>> i = 11
@ WORLD
4_World
Definition EnProfiler.c:30

◆ ToVector()

proto vector ToVector ( )
private

Returns a vector from a string.

Возвращает
vector Converted s as vector
string str = "1 0 1";
vector v = str.ToVector();
>> v = <1,0,1>
Definition EnConvert.c:106

Используется в string::BeautifiedToVector().

◆ Trim()

proto string Trim ( )
private

Returns trimmed string with removed leading and trailing whitespaces.

Возвращает
string - Trimmed string
string str = " Hello World "
Print( str.Trim() );
>> ' Hello World '
>> 'Hello World'

◆ TrimInPlace()

proto int TrimInPlace ( )
private

Removes leading and trailing whitespaces in string. Returns length.

Возвращает
int - Count of chars
string str = " Hello World ";
int i = str.TrimInPlace();
>> str = 'Hello World'
>> i = 11

Переменные

◆ Empty