AMX Mod X API Documentation

Signature
stock xs_strtrim(stringtotrim[], charstotrim, bool:fromleft = true){ if(charstotrim <= 0) return; if(fromleft) { new maxlen = strlen(stringtotrim); if(charstotrim > maxlen) charstotrim = maxlen; // In format, input and output regions can overlap format(stringtotrim, maxlen, "%s", stringtotrim[charstotrim]); } else { new maxlen = strlen(stringtotrim) - charstotrim; if(maxlen < 0) maxlen = 0; // In format, input and output regions can overlap format(stringtotrim, maxlen, "%s", stringtotrim); }}
Description

Remove @charstotrim number of characters from @stringtotrim,

either from the beginning or the end of the string.

Parameters
  • stringtotrim The string to be trimmed.
  • charstostrim The number of characters to trim.
  • fromleft If set to true, the string will be trimmer from the left.

    If false, it will be trimmed from the right.

No return value
Назад
Верх