Use splitString instead of BIS_fnc_splitString

This commit is contained in:
jonpas 2015-09-05 20:15:31 +02:00
parent f22072a94d
commit a2dd77ca70

View File

@ -1,5 +1,5 @@
/* /*
* Author: Jonpas * Author: Glowbal, Jonpas
* Makes a list from a string using comma as a delimiter, optionally trim or remove whitespace and check each for object existence. * Makes a list from a string using comma as a delimiter, optionally trim or remove whitespace and check each for object existence.
* *
* Arguments: * Arguments:
@ -17,12 +17,13 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_splittedList", "_whitespaceList", "_nilCheckedList"];
params ["_list", ["_removeWhitespace", false], ["_checkNil", false]]; params ["_list", ["_removeWhitespace", false], ["_checkNil", false]];
private ["_whitespaceList", "_nilCheckedList"];
// Split using comma delimiter // Split using comma delimiter
_splittedList = [_list, ","] call BIS_fnc_splitString; _list = _list splitString ",";
TRACE_1("Splitted List",_list);
// Remove or Trim Whitespace // Remove or Trim Whitespace
@ -34,22 +35,25 @@ _whitespaceList = [];
_whitespaceList pushBack ([_x] call CBA_fnc_trim); _whitespaceList pushBack ([_x] call CBA_fnc_trim);
}; };
nil nil
} count _splittedList; } count _list;
_list = _whitespaceList; _list = _whitespaceList;
TRACE_1("Whitespace List",_list);
// Check for object existence // Check for object existence
_nilCheckedList = [];
if (_checkNil) then { if (_checkNil) then {
_nilCheckedList = [];
{ {
if !(isNil _x) then { if !(isNil _x) then {
_nilCheckedList pushBack _x; _nilCheckedList pushBack _x;
}; };
nil
} count _list; } count _list;
_list = _nilCheckedList; _list = _nilCheckedList;
}; };
TRACE_4("Lists",_splittedList,_whitespaceList,_nilCheckedList,_list); TRACE_1("Final List",_list);
_list _list