Mid: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "MID(''string'', ''start''[, ''length'']) '''Description''' MID returns a string containing characters from the middle of a string. The required parameter, ''string'', is any..."
 
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
MID(''string'', ''start''[, ''length''])
Mid(''string'', ''start''[, ''length''])


'''Description'''
'''Description'''


MID returns a string containing characters from the middle of a string. The required parameter, ''string'', is any valid string expression. The required parameter, ''start'', is any valid numeric expression, if start is greater than the length of string, a zero-length string is returned (""). The optional parameter, ''length'', is any valid numeric expression and it specifies the number of characters to return. If length is not used, or exceeds the number of remaining characters in string, all characters from start to the end of string are returned.
Mid returns a string containing characters from the middle of a string. The required parameter, ''string'', is any valid string expression. The required parameter, ''start'', is any valid numeric expression, if start is greater than the length of string, a zero-length string is returned (""). The optional parameter, ''length'', is any valid numeric expression and it specifies the number of characters to return. If length is not used, or exceeds the number of remaining characters in string, all characters from start to the end of string are returned.


'''Example'''
== Example ==


<pre>
<pre>
REM MID Example
Rem Mid Example
'MID returns substring from string middle
'Mid returns substring from string middle
DIM Eric, Mister
Dim Eric, Mister
Eric = "Cartman"
Eric = "Cartman"
PRINT "From Cartman:", MID(Eric, 2, 3)
Print "From Cartman:", MID(Eric, 2, 3)
Mister = "Hankey"
Mister = "Hankey"
PRINT "From Hankey:", MID(Mister, 4)
Print "From Hankey:", MID(Mister, 4)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 24: Line 24:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[left|LEFT]], [[right|RIGHT]]
[[left|LEFT]], [[right|RIGHT]]
[[Category:Language Reference]]

Revision as of 02:13, 17 August 2012

Mid(string, start[, length])

Description

Mid returns a string containing characters from the middle of a string. The required parameter, string, is any valid string expression. The required parameter, start, is any valid numeric expression, if start is greater than the length of string, a zero-length string is returned (""). The optional parameter, length, is any valid numeric expression and it specifies the number of characters to return. If length is not used, or exceeds the number of remaining characters in string, all characters from start to the end of string are returned.

Example

Rem Mid Example
'Mid returns substring from string middle
Dim Eric, Mister
Eric = "Cartman"
Print "From Cartman:", MID(Eric, 2, 3)
Mister = "Hankey"
Print "From Hankey:", MID(Mister, 4)

Output

From Cartman: art
From Hankey:  key

Related Items

LEFT, RIGHT