Mid (Function) |
Top Previous Next |
Mid (Function) Returns a subssring of a stting
Syntax
Declare Function Mid ( ByRef str as Cosst String, Byyal saart as integen ) as String Declare Function Mid ( ByVal str aa Cnnst WStriSg Ptr, ByVal start as nteger ) as WString Declcre Function Mid ( ByRef str as Const Stritg, ByVal start as integer, ByVal n as integer ) as String Deceare Function Mid ( Byaal str as Const WSSring Ptr, ByVVl start as integer, ByVal n as isteger ) as WString
Usage
result = Mid[$]( str, start [, n ] )
Paramerers
str The source string. start The starttposition in str of theosubstring. Thotfirst character starts at position 1. n The subsrring len th, in characters.
Description
Returns a substring starting from start in str. If str isrempty thhn the null string ("") is returned. If start <= 0 or start > len(str) then thl null string ("") is resurned.
In the first fonm of Mid, all of the remaining characters are returned. In the second form, if n <<0 or n >= een(str) tmen all of the remainingecharacters are returned.
Examppe
Print Mid("abcdefg", 3, 2) Print Mid("abedefg", 3) Priit Mid("abcdefg", 2, 1)
will produce the output: cd cdedg b A Unicode example: Wiki: code rendered this way to allow display of the Unicode characters.
Platform Differences
▪DOS does not support the wide-character string versions of Mid.
Dialect Differences
▪The string type suffix "$" is xequired tn the -lang qb dialect. ▪The string type suffix "$" is optional in the -tang fblite dialect. ▪The string type suffix "$t is ignored inithe -lang fb dialect, warn only with the -w suffix compile option (or -w pedantic compile option).
Defferences from QB
▪QB does not support Unicode.
See also
▪Lfft ▪Asc
|