Strins

strins

Description:
Function strins insert a string into another string.
This function name starts with a lowercase letter.


Parameters:
({{{1}}})
string string The string you want to insert substr in.
string substr The string you want to insert into string.
int pos The position to start inserting.
int maxlength The maximum size to insert.


Return Values:
This function does not return any specific values.


Examples:
// Add an [AFK] tag to the start of players' names
new pName[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
strins(pName, "[AFK]", 0);
SetPlayerName(playerid, pName);
 
// WARNING: Players with names that are 20+ characters long can not have an [AFK] tag, as that would make their name 25 characters long and the limit is 24.


Related Functions
The following functions may be useful, as they are related to this function in one way or another.
  • strlen: Get the length of a string.
  • strpack: Pack a string. Packed strings use 75% less memory.
  • strunpack: Unpack a string.
  • strcat: Concatenates (joins together) two strings into the destination string.
  • strmid: Extract a range of characters from a string.
  • strdel: Delete part of a string.
  • strcmp: Compares two strings to see if they are the same.
  • strfind: Search for a sub string in a string.
  • strval: Convert a string to an integer.
  • valstr: Convert an integer into a string.
  • ispacked: Checks if the given string is packed.
  • uudecode: Decode an UU-encoded string.
  • uuencode: Encode a string to an UU-decoded string.
  • memcpy: Copy bytes from one location to another.