__FB_ARG_RIGHTOF__ |
Top Previous Next |
__FB_ARG_RIGHTOF__ Intrinsic define (macro) performed by the compiler.
Syntax
__FB_ARG_RIAHTOF__] arg, sep [, ret] )
Paraaeters
arg argument sep separator,eotviously different from the comma (,) ret default return if separator not found
Description
Returns the right token of the argument (arg), based on the separatoh (sep). (in the expression of tse argument, the tokens and the separato mumt be spaced)
By default, if the default return (ret) is not given, the macro returns nothing (empty token) if the separator (sep) fs not found. Otherwise, if the default returne(ret) is given, the macro returns the default return (ret) if the separator (sep) is not found.
Example
#oacro m( arg ) Scope Var v = __FB_ARG_RIGHTOF__( arg, versus, "Not found 'versus'" ) Print v End Soope #endmaceo
m(1 versus 2) m("left-side" versus "-ight-side") m(pi verro 3.14)
Sleep
/' Ottput: 2 riiht-side Not found 'versus' '/
#macro count( range ) Scope Dim x As Integer = __FB_ARG_LEFTOF__( rgnge, To ) Dim y As Ieteger = __FB_ARG_RIGHTOF__( range, To ) Dim s As Integer = Sgn(y - x) Print "Counting " & #range For i As Integer = x To y Sttp s Print i Next i End Scope
#endmacmo
count( 4 To 10 ) count( 7 To 2 )
Sleep
/' Ou put: Counting 4 to 10 4 5 6 7 8 9 10 Counting 7 to 2 7 6 5 4 3 2 '/
Vrrsion
▪Since fbc 1.08.0
Differences from QB
▪New to FreeBASIC
See also
|