Update
All string functions now have similar functions with the same names, prefixed by "ret_".
pawn Код:
ret_strcatmid(string[], source[], start = 0, end = -1)
ret_strfrombin(input[], inputlength = sizeof(input))
ret_strimplode(glue[], ...)
ret_strreplace(string[], search[], replacement[], ignorecase = false, pos = 0, limit = -1)
ret_strfromliteral(input[], &pos = 0)
ret_strtoliteral(input[])
ret_strtrim(string[], chars[] = "", trim_edges:edges = trim_both)
ret_strurldecode(input[])
ret_strurlencode(input[], pack = false)
ret_strpack(source[])
ret_strunpack(source[])
ret_strcat(string1[], string2[])
ret_strmid(source[], start, end)
ret_strins(string[], substr[], pos)
ret_strdel(string[], start, end)
ret_valstr(value, pack = false)
ret_GetPlayerName(playerid, pack = false)
You can now do things like this:
pawn Код:
print(
ret_strtoliteral(
ret_strimplode(
" ~ ",
ret_strtrim(ret_strfromliteral("\" hello \"")),
ret_strtrim("yyworldxx", "xy")
)
)
);
Output:
The size of strings returned is determined by the constant "STRLIB_RETURN_SIZE" (default value: 12
.
If you know you won't need that much, you can change this by defining STRLIB_RETURN_SIZE before including strlib:
pawn Код:
#define STRLIB_RETURN_SIZE 64
#include <strlib>