Arma Reforger Script API
|
Public Member Functions | |
array< int > | IndicesOf (string input, string search) |
Static Public Member Functions | |
static bool | ContainsDigit (string input) |
Check if the provided input contains any digit. | |
static bool | ContainsUppercase (string input) |
Check if the provided input contains any uppercase character (A-Z) | |
static bool | ContainsLowercase (string input) |
Check if the provided input contains any lowercase character (a-z) | |
static int | CountOccurrences (string haystack, string needle, bool caseInsensitive=false) |
Gets the amount of times a needle is found in the haystack. | |
static string | Filter (string input, string characters, bool useCharactersAsBlacklist=false) |
static bool | IsFormat (SCR_EStringFormat format, string input) |
static bool | CheckCharacters (string input, bool allowLC, bool allowUC, bool allowDigits, bool allowUnderscore=false) |
Check if the provided string respects all the limitations. | |
static string | Format (string input, notnull array< string > arguments) |
format with string arguments in the form of an array | |
static string | FormatValueNameToUserFriendly (string valueName) |
Turns e.g m_bIsValid to "Is Valid", m_bUsesAMagazine to "Uses A Magazine", m_bExportToPDFDocument to "Export To PDF Document". | |
static string | FormatResourceNameToUserFriendly (ResourceName resourceName) |
Turns "{GUID012345678910}Prefabs/Characters/Factions/Faction/Character_FactionName_NLAW.et" into "Character FactionName NLAW". | |
static string | FormatSnakeCaseToUserFriendly (string snakeCase) |
Turns "THIS_IS_AN_ENUM" or "tHIs_is_aN_enUM" into "This Is An Enum". | |
static array< float > | GetFloatsFromString (string input, string splitter=SPACE) |
Gets float values array from a string (e.g { 0.3, 5.0, 7.9 } from "0.3 5.0 abc 7.9") | |
static array< int > | GetIntsFromString (string input, string splitter=SPACE) |
Gets int values array from a string (e.g { 3, 5, 7 } from "3 5 abc 7") | |
static array< string > | GetLines (string input, bool removeEmptyLines=false, bool trimLines=false) |
Obtain an array of lines from a multiline string - split is done on the \n character. | |
static int | IndexOf (string input, notnull array< string > samples) |
Finds the first occurrence of the provided samples. | |
static int | IndexOfFrom (string input, int start, notnull array< string > samples) |
Finds the first occurrence of the provided samples from a position. | |
static string | InsertAt (string input, string insertion, int insertionIndex=0) |
Insert a string into another string. | |
static bool | IsEmptyOrWhiteSpace (string input) |
static bool | IsTranslationKey (string input) |
Returns if the provided string is in the translation key format (e.g #AR-Translation_Value_3) - the pound sign (#) must be present! | |
static string | Join (string separator, notnull array< string > pieces, bool joinEmptyEntries=true) |
Joins strings together (reverse operation of string.Split) | |
static string | Join (string separator, notnull array< bool > pieces, bool numerical=false) |
Joins bools together as string. | |
static string | Join (string separator, notnull array< int > pieces) |
Joins ints together as string. | |
static string | Join (string separator, notnull array< float > pieces) |
Joins floats together as string. | |
static int | GetLevenshteinDistance (string word1, string word2, bool caseSensitive=true) |
Calculate the Levenshtein distance between two words (https://en.wikipedia.org/wiki/Levenshtein_distance) | |
static float | GetLevenshteinDistanceScore (string word1, string word2, bool caseSensitive=true) |
static int | GetDamerauLevenshteinDistance (string word1, string word2, bool caseSensitive=true) |
Calculate the Damerau-Levenshtein Optimal string Alignment (OSA) distance between two words (https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance) . | |
static float | GetDamerauLevenshteinDistanceScore (string word1, string word2, bool caseSensitive=true) |
static string | PadLeft (string input, int length, string padding=SPACE) |
Pads the provided string's left end (start) with the provided padding (cut to the exact length) Will not do anything if input is already longer than length or if padding is empty If input is longer, it will not be cut. | |
static string | PadRight (string input, int length, string padding=SPACE) |
Pads the provided string's right end (end) with the provided padding (cut to the exact length) Will not do anything if input is already longer than length or if padding is empty If input is longer, it will not be cut. | |
static string | ReplaceRecursive (string input, string sample, string replacement) |
Replace until there is no trace of search. | |
static string | ReplaceMultiple (string input, notnull array< string > samples, string replacement) |
Replaces multiple entries by the same replacement. | |
static string | ReplaceTimes (string input, string sample, string replacement, int howMany=1, int skip=0) |
Replace X times a string from within a string from left to right the next occurrence is searched after the previous replacement, there is no overlap. | |
static string | Reverse (string input) |
Returns the provided input string reversed. | |
static bool | SimpleStarSearchMatches (string haystack, string needle, bool caseSensitive, bool strictMatch) |
Search a string with star-keywords - only supports begin* / end / *contains search format. | |
static bool | ContainsAny (string input, notnull array< string > needles) |
Check if input contains any needles. | |
static bool | ContainsEvery (string input, notnull array< string > needles) |
Check if input contains every needles. | |
static bool | ContainsOnly (string input, string characters, bool useCharactersAsBlacklist=false) |
static bool | StartsWithAny (string input, notnull array< string > lineStarts) |
Find out if a string's beginning matches one of the provided beginnings. | |
static bool | EndsWithAny (string input, notnull array< string > lineEnds) |
Find out if a string's ending matches one of the provided endings. | |
static string | Translate (string input, string param1=string.Empty, string param2=string.Empty, string param3=string.Empty, string param4=string.Empty, string param5=string.Empty, string param6=string.Empty, string param7=string.Empty, string param8=string.Empty, string param9=string.Empty) |
Get the actual translation from the translation key If not a translation key, the provided input is returned It is NOT recommended to manipulate a potentially non-ASCII string (multibyte UTF-8), use at your own risk! | |
static string | Translate (string input, notnull array< string > arguments) |
Get the actual translation from the translation key If not a translation key, the provided input is returned It is NOT recommended to manipulate a potentially non-ASCII string (multibyte UTF-8) in script, use at your own risk! | |
static string | TrimLeft (string input) |
Remove spaces, tabs and line returns on the left end of the provided string Vertical tabs and other characters are ignored and considered as normal characters (for now?) | |
static string | TrimRight (string input) |
Remove spaces, tabs and line returns on the right end of the provided string Vertical tabs and other characters are ignored and considered as normal characters (for now?) | |
Static Public Attributes | |
static const string | LOWERCASE = "abcdefghijklmnopqrstuvwxyz" |
static const string | UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
static const string | LETTERS = LOWERCASE + UPPERCASE |
static const string | DIGITS = "0123456789" |
static const string | ALPHANUMERICAL = LETTERS + DIGITS |
static const string | UNDERSCORE = "_" |
static const string | ALPHANUMERICAL_U = ALPHANUMERICAL + UNDERSCORE |
static const string | DASH = "-" |
static const string | COLON = ":" |
static const string | SEMICOLON = ";" |
static const string | COMMA = "," |
static const string | SPACE = " " |
static const string | STAR = "*" |
static const string | POUND = "#" |
static const string | HASHTAG = POUND |
static const string | QUESTION_MARK = "?" |
static const string | EXCLAMATION_MARK = "!" |
static const string | DOUBLE_SPACE = SPACE + SPACE |
static const string | QUADRUPLE_SPACE = DOUBLE_SPACE + DOUBLE_SPACE |
static const string | SINGLE_QUOTE = "'" |
static const string | DOUBLE_QUOTE = "\"" |
static const string | TAB = "\t" |
static const string | LINE_RETURN = "\n" |
static const string | SLASH = "/" |
static const string | DOUBLE_SLASH = SLASH + SLASH |
static const string | ANTISLASH = "\\" |
static const string | DOUBLE_ANTISLASH = ANTISLASH + ANTISLASH |
static const string | LIPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." |
Static Protected Attributes | |
static const string | TRANSLATION_KEY_CHARS = UNDERSCORE + DASH |
static const int | MIN_LC = 97 |
static const int | MAX_LC = 122 |
static const int | MIN_UC = 65 |
static const int | MAX_UC = 90 |
static const int | MIN_DIGIT = 48 |
static const int | MAX_DIGIT = 57 |
|
static |
Check if the provided string respects all the limitations.
[in] | allowLC | allow LowerCase characters (abc..xyz) |
[in] | allowUC | allow UpperCase characters (ABC..XYZ) |
[in] | allowDigits | allow all numbers (012..789) |
[in] | allowUnderscore | allow underscore (_) |
|
static |
Check if input contains any needles.
[in] | input | |
[in] | needles |
|
static |
Check if the provided input contains any digit.
[in] | input |
|
static |
Check if input contains every needles.
[in] | input | |
[in] | needles |
|
static |
Check if the provided input contains any lowercase character (a-z)
[in] | input |
|
static |
[in] | input | the input string |
[in] | characters | the characters that must compose input or that must not be present depending on useCharactersAsBlacklist |
[in] | useCharactersAsBlacklist | false for characters to be a whitelist, true for a blacklist |
|
static |
Check if the provided input contains any uppercase character (A-Z)
[in] | input |
|
static |
Gets the amount of times a needle is found in the haystack.
e.g looking for "AA" in "AAAAA" will find it twice.
[in] | haystack | the string in which to search |
[in] | needle | the string to find |
[in] | caseInsensitive | if set to true, the search will be case-insensitive (e.g "A" will match "a" and vice-versa) |
|
static |
Find out if a string's ending matches one of the provided endings.
[in] | input | the string to check |
[in] | lineEnds | the endings to parse |
|
static |
[in] | input | the input string |
[in] | characters | the characters to either respect or remove depending on useCharactersAsBlacklist |
[in] | useCharactersAsBlacklist | false for characters to be a whitelist, true for a blacklist |
|
static |
format with string arguments in the form of an array
[in] | format | with %1, %2 etc |
[in] | arguments | array |
|
static |
Turns "{GUID012345678910}Prefabs/Characters/Factions/Faction/Character_FactionName_NLAW.et" into "Character FactionName NLAW".
[in] | resourceName |
|
static |
Turns "THIS_IS_AN_ENUM" or "tHIs_is_aN_enUM" into "This Is An Enum".
[in] | snakeCase | any string with words separated by underscores |
|
static |
Turns e.g m_bIsValid to "Is Valid", m_bUsesAMagazine to "Uses A Magazine", m_bExportToPDFDocument to "Export To PDF Document".
[in] | valueName |
|
static |
Calculate the Damerau-Levenshtein Optimal string Alignment (OSA) distance between two words (https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance)
.
[in] | word1 | |
[in] | word2 | |
[in] | caseSensitive |
|
static |
|
static |
Gets float values array from a string (e.g { 0.3, 5.0, 7.9 } from "0.3 5.0 abc 7.9")
[in] | input | |
[in] | splitter | space by default, can be a comma from e.g IEntitySource values |
|
static |
Gets int values array from a string (e.g { 3, 5, 7 } from "3 5 abc 7")
[in] | input | |
[in] | splitter | space by default, can be a comma from e.g IEntitySource values |
|
static |
Calculate the Levenshtein distance between two words (https://en.wikipedia.org/wiki/Levenshtein_distance)
[in] | word1 | |
[in] | word2 | |
[in] | caseSensitive |
|
static |
|
static |
Obtain an array of lines from a multiline string - split is done on the \n character.
[in] | input | |
[in] | removeEmptyLines | if true, remove empty lines (including trimmed ones) |
[in] | trimLines | if true, trim lines |
|
static |
Finds the first occurrence of the provided samples.
[in] | input | |
[in] | samples |
|
static |
Finds the first occurrence of the provided samples from a position.
[in] | input | |
[in] | start | |
[in] | samples |
array< int > SCR_StringHelper.IndicesOf | ( | string | input, |
string | search ) |
[in] | input | |
[in] | search |
|
static |
Insert a string into another string.
[in] | input | the text in which to insert |
[in] | insertion | the text to insert |
[in] | insertionIndex | default 0 |
|
static |
[in] | input |
|
static |
[in] | format | |
[in] | input | must be ASCII |
|
static |
Returns if the provided string is in the translation key format (e.g #AR-Translation_Value_3) - the pound sign (#) must be present!
[in] | input |
|
static |
Joins bools together as string.
[in] | separator | usually "," for an int array |
[in] | pieces | the pieces to be joined |
[in] | numerical | whether or not true is stringified as 1 and false as 0, or written full text ("true" and "false") |
|
static |
Joins floats together as string.
[in] | separator | usually "," for a float array |
[in] | pieces | the pieces to be joined |
|
static |
Joins ints together as string.
[in] | separator | usually "," for an int array |
[in] | pieces | the pieces to be joined |
|
static |
Joins strings together (reverse operation of string.Split)
[in] | separator | usually ", " for a string array |
[in] | pieces | the pieces to be joined |
[in] | joinEmptyEntries | if set to false, will ignore empty pieces (to e.g avoid ", , " occurrences) |
|
static |
Pads the provided string's left end (start) with the provided padding (cut to the exact length) Will not do anything if input is already longer than length or if padding is empty If input is longer, it will not be cut.
[in] | input | |
[in] | length | |
[in] | padding |
|
static |
Pads the provided string's right end (end) with the provided padding (cut to the exact length) Will not do anything if input is already longer than length or if padding is empty If input is longer, it will not be cut.
[in] | input | |
[in] | length | |
[in] | padding |
|
static |
Replaces multiple entries by the same replacement.
[in] | input | |
[in] | samples | |
[in] | replacement |
|
static |
Replace until there is no trace of search.
[in] | input | the input in which to search and replace |
[in] | what | to replace - an empty sample will do nothing |
[in] | replacement | CANNOT contain sample for an obvious reason |
|
static |
Replace X times a string from within a string from left to right the next occurrence is searched after the previous replacement, there is no overlap.
[in] | input | the input in which to search and replace |
[in] | sample | what to replace - an empty sample will do nothing |
[in] | replacement | the replacement string |
[in] | howMany | times the string must be replaced |
[in] | skip | first occurrences -not- to be replaced |
|
static |
Returns the provided input string reversed.
[in] | input |
|
static |
Search a string with star-keywords - only supports begin* / end / *contains search format.
[in] | haystack | |
[in] | needle | the star-based search:
|
[in] | caseSensitive | whether or not the search is case-sensitive |
[in] | strictMatch | star is a REQUIREMENT and not a POSSIBILITY:
|
|
static |
Find out if a string's beginning matches one of the provided beginnings.
[in] | input | the string to check |
[in] | lineStarts | the beginnings to parse |
|
static |
Get the actual translation from the translation key If not a translation key, the provided input is returned It is NOT recommended to manipulate a potentially non-ASCII string (multibyte UTF-8) in script, use at your own risk!
[in] | input | |
[in] | arguments |
|
static |
Get the actual translation from the translation key If not a translation key, the provided input is returned It is NOT recommended to manipulate a potentially non-ASCII string (multibyte UTF-8), use at your own risk!
[in] | input | |
[in] | param1 | |
[in] | param2 | |
[in] | param3 | |
[in] | param4 | |
[in] | param5 | |
[in] | param6 | |
[in] | param7 | |
[in] | param8 | |
[in] | param9 |
|
static |
Remove spaces, tabs and line returns on the left end of the provided string Vertical tabs and other characters are ignored and considered as normal characters (for now?)
[in] | input |
|
static |
Remove spaces, tabs and line returns on the right end of the provided string Vertical tabs and other characters are ignored and considered as normal characters (for now?)
[in] | input |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
staticprotected |
|
static |
|
static |