INSERTCHAR
From MCS Wiki AVR
Contents |
Action
Inserts one character into a string.
Syntax
INSERTCHAR string, pos, char
Remarks
string |
The string where the character is inserted to. |
pos |
The position where the character is inserted to. A value of 1 would make the character the first character of the string. |
char |
A byte or string or string constant with the character that need to be inserted. For example you can use "A" to insert an "A", or use a byte with the value 65 to insert an "A". Or use a string. In case of a string, only the first character will be used. |
See also
DELCHAR , DELCHARS , INSTR , MID , CHARPOS , REPLACECHARS
Example
'---------------------------------------------------------------- ' (c) 1995-2011, MCS ' del_insert_chars.bas ' This sample demonstrates the delchar, delchars and insertchar statements '----------------------------------------------------------------- $regfile="m88def.dat" $crystal = 8000000 $hwstack = 40 $swstack = 40 $framesize = 40 dim s as string * 30 s = "This is a test string" ' create a string delchar s, 1 ' remove the first char print s ' print it insertchar s,1, "t" ' put a small t back print s delchars s,"s" ' remove all s print s end
Languages | English • Deutsch |
---|