|
Mid$ | ||
ReturnString$ = Mid$(SourceString$, Position, [Length=1]) | ||
Parameters: SourceString$ = The string you want to copy characters from Position = The first character (from the left) of where to start grabbing characters [Length=1] = The optional number of characters to grab, defaults to 1 |
||
Returns: ReturnString$ |
||
The Mid$() function allows us to copy single character or run of characters from a source string to another string. The characters are copied in a left to right order, starting at the position parameter and ending at Position + Length. It's important to understand that MID$ does not remove the characters from the Source String, it just copies the selection of characters from the source string into a new string result. FACTS: * If either the character position or copy length are outside the source strings length, the returned string fragment will be clipped to length of the source string. * The Mid$() function always returns a string. So if you want to read the strings ASCII values directly you should use MID() function. Mini Tutorial:
In this example, the MID$ function will copy two characters from the string number$ starting at character five (from the left hand side). So it will output the characters 56 to the display. This example would output
|
||
Example Source: Download This Example
|
Related Info: | Left$ | Mid | Right$ | SplitToArray | Trim$ | TrimLEft$ | TrimRight$ : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |