-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace replace #331
Replace replace #331
Conversation
// ---------------------------------------------------------------------------- | ||
params [["_string", "", [""]], ["_find", "", [""]], ["_replace", "", [""]]]; | ||
private ["_offset", "_index"]; | ||
if (_find == "" || {_replace find _find != -1}) exitWith {_string}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. ...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks for infinite loops when you would do something like:
["Hello", "e", "ee"] call CBA_fnc_replace;
Before:
After:
|
This works now:
|
Passes the test now
The benefit of this PR:
After:
We should probably add that and |
Performance: Before: 0.0525 ms |
Agree - please add the two new tests to the unit test suite. |
Those two tests have been added. |
This PR replaces the replace function. The old one does not work properly with some characters (for example öüäß) due to buggy BI commands:
It also adds params checking and doesn't use any
toArray
/toString
stuff anymore.