DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ParseTextToArray()

TStringArray PluginFileHandler::ParseTextToArray ( string text,
out TStringArray ret )
inlineprivate

См. определение в файле PluginLocalProfile.c строка 243

244 {
245 if ( !IsTextArray(text) )
246 {
247 return NULL;
248 }
249
250 text = text.Substring(1, text.Length() - 2);
251
252 int pos_array_start = text.IndexOf("{");
253 int pos_array_end = text.IndexOf("}");
254
255 if ( pos_array_start > -1 && pos_array_end > -1 )
256 {
257 while ( true )
258 {
259 string array_value = text.Substring(pos_array_start , pos_array_end - pos_array_start + 1 );
260 ret.Insert(array_value);
261
262 pos_array_start = text.IndexOfFrom(pos_array_end, "{");
263 pos_array_end = text.IndexOfFrom(pos_array_start, "}");
264
265 if ( pos_array_start == -1 )
266 {
267 break;
268 }
269 }
270 }
271 else
272 {
273 text.Split(",", ret);
274 }
275
276 return ret;
277 }
bool IsTextArray(string text)
Определения PluginLocalProfile.c:205
proto native int Length()
Returns length of string.
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.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
Определения EnString.c:396
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOfFrom(int start, string sample)
Finds 'sample' in 'str' from 'start' position. Returns -1 when not found.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.

Перекрестные ссылки string::IndexOf(), string::IndexOfFrom(), string::Insert(), IsTextArray(), string::Length(), string::Split() и string::Substring().

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