Brick icon

A3 Custom funcs

Brick | PRO | 08/17/16 09:32:32 PM UTC | 0 ⭐ | 303 👁️ | Never ⏰ | []
SQF |

1.21 KB

|

None

|

0 👍

/

0 👎

span class="re5"> replaceInString =
{
    if !(_this isEqualTypeArray ["", "", ""]) exitWith
    {
        "";
    };
 
    _string = param[0];
    _from   = param[1];
    _to     = param[2];
 
    if (_from isEqualTo "") exitWith
    {
        _string;
    };
 
    _parts = [ ];
 
    while { true } do
    {
        _find = _string find _from;
 
        if (_find == -1) exitWith
        {
            _parts pushBack _string;
        };
 
        _parts pushBack (_string select [0, _find]);
 
        _string = _string select [_find + count _from];
    };
 
    _parts joinString _to;
};
 
compileConst =
{
    _convertToString =
    {
        if (_this isEqualType [ ]) exitWith
        {
            _this apply { _x call _convertToString };
        };
 
        if (_this isEqualType "") exitWith
        {
            _this splitString '"' joinString '""';
        };
 
        if (_this isEqualTypeAny [false, 0, { }]) exitWith
        {
            _this;
        };
 
        "";
    };
 
    compileFinal str (_this call _convertToString);
};
 
compileFunc =
{
    if !(_this isEqualType { }) exitWith { };
 
    _string = str _this;
 
    compileFinal (_string select [1, count _string - 2]);
};

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎