Fixed #2222 - Allow spaces in slideshow module by just trimming the splitted input string rather than removing all whitespace

This commit is contained in:
jonpas 2015-08-23 19:48:57 +02:00
parent 50e851d2c8
commit 6d15e63f85

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Text <STRING>
* 1: Remove Whitespace <BOOL>
* 1: Trim Whitespace <BOOL>
* 2: Check Nil <BOOL>
*
* Return Value:
@ -15,24 +15,24 @@
*
* Public: No
*/
//#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_list", "_removeWhitespace", "_checkNil"];
params ["_list", "_trimWhitespace", "_checkNil"];
private ["_splittedList", "_listNoWhitespace", "_nilCheckPassedList"];
private ["_splittedList", "_listTrimmedWhitespace", "_nilCheckPassedList"];
// Split using comma delimiter
_splittedList = [_list, ","] call BIS_fnc_splitString;
// Remove whitespace
_listNoWhitespace = [];
if (_removeWhitespace) then {
_listTrimmedWhitespace = [];
if (_trimWhitespace) then {
{
_listNoWhitespace pushBack ([_x] call EFUNC(common,stringRemoveWhiteSpace));
_listTrimmedWhitespace pushBack ([_x] call CBA_fnc_trim);
nil
} count _splittedList;
_list = _listNoWhitespace;
_list = _listTrimmedWhitespace;
};
// Check for object existence
@ -53,6 +53,6 @@ if (_checkNil) then {
_list = [] call compile _list;
};
TRACE_4("Lists",_splittedList,_listNoWhitespace,_nilCheckPassedList,_list);
TRACE_4("Lists",_splittedList,_listTrimmedWhitespace,_nilCheckPassedList,_list);
_list // return