Firstchars

From SA-MP Wiki

Jump to: navigation, search

firstchars

Image:Farm-Fresh text lowercase.png Note: This function name starts with a lowercase letter.


Description:

Extract the first characters from a string


Parameters:
(const source[], len=1)
const source[]The string from which to extract characters
len=1The number of how many characters to return


Return Values:

The first characters defined by len


new string[MAX_STRING];
format(string,sizeof(string),firstchars("SAVE only the first 4 characters", 4)); // string = "SAVE"
format(string,sizeof(string),firstchars("Save only the first characters")); // string = "S"


Related Functions

The following functions may be useful, as they are related to this function in one way or another.

  • lastchars: Extract the last characters from a string
  • left: Extract all characters from a string, which are left of a character
  • right: Extract all characters from a string, which are right of a character
  • strmid: Extract a range of characters from a string
Personal tools
Navigation
Toolbox