27.11.2016, 22:21
(
Last edited by VVWVV; 28/11/2016 at 02:58 PM.
)
Description:
This library adds new functions to work with strings. All functions supports the packed strings!Functions:
Download:
Erase:
erase_first(string[], const find[], bool:ignorecase = false, pos = 0);Description:erase_last(string[], const find[], bool:ignorecase = false);Remove the first occurrence of the substring from the string.Returns:The beginning Position of the substring in the string.Description:erase_nth(string[], const find[], n, bool:ignorecase = false, pos = 0);Remove the last occurrence of the substring from the string.Returns:The beginning Position of the substring in the string.Description:erase(string[], start_pos, length = cellmax);Remove the Nth occurrence of the substring in the string.Returns:-1Description:Remove the part of the substring in the string.Returns:-1
Find:
find_first(const string[], const find[], bool:ignorecase = false, pos = 0);Description:find_last(const string[], const find[], bool:ignorecase = false);Search for a substring(find) in the string.Returns:The beginning position of the substring in the string, otherwise -1Description:find_first_of(const string[], const charlist[], pos_string = 0, size = sizeof string);Search for the last occurrence of a substring(find) in the string.Returns:The beginning position of the substring in the string, otherwise -1Description:find_last_of(const string[], const charlist[]);Search for the symbol from the array(charlist) in the string.Returns:The position of the first character in the string, otherwise -1Description:find_first_not_of(const string[], const charlist[], pos_string = 0, size = sizeof string);Search for the symbol from the array(charlist) from the end of the string.Returns:The position of the first character from the end of the string, otherwise -1Description:find_last_not_of(const string[], const charlist[]);Search for the first symbol not from the array(charlist) in the string.Returns:The position in the string, otherwise -1Description:Search for the first symbol not from the array(charlist) from the end of the string.Returns:The position in the string, otherwise -1
Replace:
replace_first(string[], const find[], const replace[], bool:ignorecase = false, pos = 0, string_size = sizeof string);Description:replace_last(string[], const find[], const replace[], bool:ignorecase = false, pos = 0, string_size = sizeof string);Replace the first occurrence of a substring(find) string(replace).Returns:If the string is found, 1, otherwise 0.Description:replace_nth(string[], const find[], const replace[], n, bool:ignorecase = false, pos = 0, string_size = sizeof string);Replace the last occurrence of a substring(find) string(replace).Returns:If the string is found, 1, otherwise 0.Description:replace_all(string[], const find[], const replace[], bool:ignorecase = false, pos = 0, string_size = sizeof string);Replace the Nth occurrence of the substring in the string.Returns:If the string is found, 1, otherwise 0.Description:Replace all substring in the stringReturns:If the string is found, 1, otherwise 0.
Trim:
trim_left(string[], const delimiter = ' ');Description:trim_right(string[], const delimiter = ' ');Remove all leading spaces from the string.Returns:-Description:trim(string[], const delimiter = ' ');Remove all trailing spaces from the string.Returns:-Description:trim_leftex(string[], const delimiters = !" ");Remove all both spaces from the string.Returns:-Description:trim_rightex(string[], const delimiters = !" ");Remove all leading spaces from the string.Returns:-Description:trim_ex(string[], const delimiters = !" ");Remove all trailing spaces from the string.Returns:-Description:Remove all both spaces from the string.Returns:-
Useful:
IsEmptyString(const string[]);Description:strcount(const string[], const find[], bool:ignorecase = false, pos = 0, string_size = sizeof string);Find out if a string is empty.Returns:Returns true if the string is empty, otherwise falseDescription:strreverse(string[]);Counts the number of substrings(find) in the string.Returns:The number of nested substringsDescription:strparttoupper(string[], part_start, part_end, string_size = sizeof string);Reverses the string.Returns:-Description:strparttolower(string[], part_start, part_end, string_size = sizeof string);This function changes lowercase letters to uppercase in the string.Returns:-Description:countofuppercase(const string[]);This function changes all uppercase to lowercase letters in the string.Returns:-Description:countoflowpercase(const string[]);Count the number of uppercase letters in the string.Returns:a number (percentage)Description:strtrtrans(string[]);Count the number of lowercase letters in the string.Returns:a number (percentage)Description:islowerpart(const string[], start_part_pos, end_part_pos);Translate Russian characters in the transliteration.Returns:-Description:isupperpart(const string[], start_part_pos, end_part_pos);Checks the string part on the content of the lowercase characters.Returns:Returns true, otherwise falseDescription:strcatex(dest[], size, const ...);Checks the string part on the content of the uppercase characters.Returns:Returns true, otherwise falseDescription:strfill(string[], const pattern[] = " ", fill_length, E_TDW_FILL_TYPE:type = FILL_TYPE_BOTH, size = sizeof string);Concatenate the strings to each other by means of strcat.Returns:Returns the number of characters.Description:strimplodeex(dest[], const delimiter[] = !" ", dest_size = sizeof dest, const ...);Fill a string with the specified substring.Returns:Returns 1 if fill_length less than size, otherwise 0.Description:strimplode(dest[], const arrays[][], const delimiter[] = !" ", array_items = sizeof arrays, dest_size = sizeof dest);Fill in string with a separator(delimiter).Returns:The number of characters (without separators).Description:strsplit(dest[], const string[], &index, const seperator = ' ');Same as strimplodeex, however, the values from the array.Returns:-Description:replace_symbol(string[], const _char, replace, pos = 0);The similarity strtok, but in a better form. Note: doesn't work with the packed strings.Returns:-Description:replace_symbols(string[], const _char, replace, pos = 0);Replace a single character in the string.Returns:-Description:Replace the characters in the string.Returns:-
githubInstallation:
- Download it!
- Copy all files to the folder '/pawno/include' which is located in the folder with the server.
- The library need to include after the SAMP libraries.
Example:
pawn Code:#include <a_samp>
#include <tdw_string> - Compile the modified scripts!
- Untonyst
- Nexius
- ziggi
- DeimoS
- Stepashka