Strmid

From SA-MP Wiki

Jump to: navigation, search

strmid

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


Description:

Extract a range of characters from a string.


Parameters:
(dest[],const source[],start,end,maxlength=sizeof dest)
dest[]The string to store the extracted characters in.
const source[]The string from which to extract characters.
startThe position of the first character.
endThe position of the last character.
maxlength=sizeof destThe length of the destination. (Will be the size of dest by default)


Return Values:

The number of characters stored in dest[]


Example Usage:

strmid(string, "Extract 'HELLO' without the !!!!: HELLO!!!!", 34, 39); //string contains "HELLO"

Related Functions

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

  • strcmp: Compare two strings to check if they are the same.
  • strfind: Search for a string in another string.
  • strtok: Get the next 'token' (word/parameter) in a string.
  • strdel: Delete part of a string.
  • strins: Insert text into a string.
  • strlen: Get the length of a string.
  • strpack: Pack a string into a destination string.
  • strval: Convert a string into an integer.
  • strcat: Concatenate two strings into a destination reference.
Personal tools
Navigation
Toolbox