-
Notifications
You must be signed in to change notification settings - Fork 739
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
Fix Multiple Issues With Timestamps #8034
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: commy2 | ||
* Removes timestamp from end of a string. | ||
* | ||
* Arguments: | ||
* 0: Marker text string <STRING> | ||
* | ||
* Return Value: | ||
* Input with timestamp removed <STRING> | ||
* | ||
* Example: | ||
* "abc [12:00 am]" call ace_markers_fnc_removeTimestamp // "abc" | ||
* "[13:37]" call ace_markers_fnc_removeTimestamp // "" | ||
* "xyz [123]" call ace_markers_fnc_removeTimestamp // "xyz [123]" | ||
* "xyz [12]" call ace_markers_fnc_removeTimestamp // "xyz" | ||
* "xyz [12 pm]" call ace_markers_fnc_removeTimestamp // "xyz" | ||
* | ||
* Public: No | ||
*/ | ||
#define DIGITS "0123456789" | ||
|
||
params ["_original"]; | ||
|
||
// @todo, 2.02 reverse command will support STRING types | ||
private _string = toArray _original; | ||
reverse _string; | ||
_string = toString _string; | ||
|
||
if (_string select [0, 1] != "]") exitWith {_original}; | ||
|
||
private _timestampLength = (_string find "[") + 1; | ||
_string = _string select [0, _timestampLength]; | ||
|
||
// @todo | ||
_string = toArray _string; | ||
reverse _string; | ||
_string = toString _string; | ||
|
||
if (_string select [0, 1] != "[") exitWith {_original}; | ||
|
||
private _index = 1; | ||
private _keepCheckingDigits = true; | ||
private _validTimestamp = true; | ||
while {_keepCheckingDigits} do { | ||
if (!(_string select [_index, 1] in DIGITS)) exitWith { _validTimestamp = false; }; | ||
if (!(_string select [_index+1, 1] in DIGITS)) exitWith { _validTimestamp = false; }; | ||
switch (_string select [_index+2, 1]) do { | ||
case (":"): { | ||
_index = _index + 3; | ||
}; | ||
case ("]"): { | ||
_keepCheckingDigits = false; | ||
}; | ||
case (" "): { | ||
_keepCheckingDigits = false; | ||
if (!(_string select [_index+3, 3] in ["am]", "pm]"])) then {_validTimestamp = false; }; | ||
}; | ||
default { | ||
_keepCheckingDigits = false; | ||
_validTimestamp = false; | ||
}; | ||
}; | ||
}; | ||
|
||
if (_validTimestamp) then { | ||
[_original select [0, count _original - _timestampLength], " "] call CBA_fnc_rightTrim // return | ||
} else { | ||
_original // return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
reverse
does not like unicodecopies as
"�ссѵЀѿ� �добовС�"
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.
: (
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.
With forceUnicode? Can you please also make a FT ticket for that example if its really broken?