Functions
string.inc
amxmodx 1.8.2 hg65
| Function | Type | Description |
|---|---|---|
| add | native | Adds one string to another. Last parameter different from 0, specifies how many chars we want to add. Function returns number of all merged chars. |
| contain | native | Checks if source contains string. On success function returns position in source, on failure returns -1. |
| containi | native | Checks if source contains string with case ignoring. On success function returns position in source, on failure returns -1. |
| copy | native | Copies one string to another. By len var you may specify max. number of chars to copy. |
| copyc | native | Copies one string to another until char ch is found. By len var you may specify max. number of chars to copy. |
| equal | native | Checks if two strings equal. If len var is set then there are only c chars comapred. |
| equali | native | Checks if two strings equal with case ignoring. If len var is set then there are only c chars comapred. |
| float_to_str | native | Converts float to string. |
| format | native | Fills string with given format and parameters. Function returns number of copied chars. Example: format(dest,"Hello %s. You are %d years old","Tom",17). If any of your input buffers overlap with the destination buffer, format() falls back to a "copy-back" version as of 1.65. This is slower, so you should using a source string that is the same as the destination. |
| format_args | native | Gets parameters from function as formated string. |
| formatex | native | Same as format(), except does not perform a "copy back" check. This means formatex() is faster, but DOES NOT ALLOW this type of call: formatex(buffer, len, "%s", buffer) formatex(buffer, len, buffer, buffer) formatex(buffer, len, "%s", buffer[5]) This is because the output is directly stored into "buffer", rather than copied back at the end. |
| isalnum | native | Returns true when value is letter or digit. |
| isalpha | native | Returns true when value is letter. |
| isdigit | native | Returns true when value is digit. |
| isspace | native | Returns true when value is space. |
| num_to_str | native | Converts number to string. |
| parse | native | Gets parameters from text. Example: to split text: "^"This is^" the best year", call function like this: parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4) and you will get: "This is", "the", "best", "year" Function returns number of parsed parameters. |
| replace | native | Replaces given string to another in given text. |
| setc | native | Sets string with given character. |
| str_to_float | native | Parses a float. |
| str_to_num | native | Returns converted string to number. |
| strbreak | native | Gets parameters from text one at a time It breaks a string into the first parameter and the rest of the parameters (A left side and right side of the string) Example: to split text: "^"This is^" the best year", strbreak(text, arg1, len1, arg2, len2) arg1="This is", arg2=the best year This is more useful than parse() because you can keep breaking any number of arguments |
| strcat | native | Concatenates a string. Maxlength is the total buffer of the destination. |
| strcmp | native | Compares two strings with the C function strcmp(). Returns 0 on equal. |
| strfind | native | Finds a string in another string. Returns -1 if not found. |
| strtok | native | Breaks a string into two halves, by token. See strbreak() for doing this with parameters. Example: str1[] = This *is*some text strtok(str1, left, 24, right, 24, '*') left will be "This " Right will be "is*some text" If you use trimSpaces, all spaces are trimmed from Left. |
| strtolower | native | Converts all chars in string to lower case. |
| strtoupper | native | Converts all chars in string to upper case. |
| trim | native | Strips spaces from the beginning and end of a string. |
| ucfirst | native | Make a string's first character uppercase |
| vdformat | native | Same as vformat(), except works in normal style dynamic natives. Instead of passing the format arg string, you can only pass the actual format argument number itself. If you pass 0, it will read the format string from an optional fifth parameter. |
| vformat | native | Replacement for format_args. Much faster and %L compatible. This works exactly like vsnprintf() from C. You must pass in the output buffer and its size, the string to format, and the number of the FIRST variable argument parameter. For example, for: function (a, b, c, ...) You would pass 4 (a is 1, b is 2, c is 3, et cetera). There is no vformatex(). |
| is_str_num | stock | Tests if given string contains only digits. Also, returns false for zero-length strings. |
| remove_filepath | stock | Removes a path from szFilePath leaving the name of the file in szFile for a pMax length. |
| replace_all | stock | Replaces a contained string iteratively. This ensures that no infinite replacements will take place by intelligently moving to the next string position each iteration. |
| split | stock | It is basically strbreak but you have a delimiter that is more than one character in length. You pass the Input string, the Left output, the max length of the left output, the right output , the max right length, and then the delimiter string. By Suicid3 |