Skip to content

Fb Quote

Paul Squires edited this page Oct 14, 2026 · 2 revisions

Home › Intrinsic Defines › FB_QUOTE

FB_QUOTE

Intrinsic define (macro) performed by the compiler.

Syntax

__FB_QUOTE__( arg )

Parameters

  • arg

Description

Converts the argument to a string, similar to stringize operator (#) but can be used anywhere (will expand the argument before conversion).
More precisely, __FB_QUOTE__ returns an over-quoted text (prefixed with the Operator $ (Non-Escaped String Literal)) compared to the one passed through the argument (the argument may already be a string, and so the return will be an over-quoted string in this case).

Remarks

Differences from QB

  • New to FreeBASIC

See also

Examples

#macro m( arg )

    Scope

        Dim s1 As String = #arg

        Print s1

        Dim s2 As String = __FB_QUOTE__( arg )

        Print s2

    End Scope

#endmacro

m(Hello)

Print

m("Hello")

Sleep

/' Output:

Hello

Hello

"Hello"

"Hello"

'/
#macro m( arg1, arg2 )

    Scope

        'Dim s0 As String = #arg1##arg2  ' does not work because arg1##arg2 is not developped before applying #

        Dim s1 As String = #arg1###arg2  ' workaround because #arg => $"arg" and not only "arg"

                                         '    (otherwise the result would be "arg1""arg2" => "arg1"arg2")

        Print s1

        Dim s2 As String = __FB_QUOTE__( arg1##arg2 )

        Print s2

    End Scope

#endmacro

m(Free, BASIC)

Sleep

/' Output:

FreeBASIC

FreeBASIC

'/

See also __FB_UNQUOTE__ example.


Category: Intrinsic Defines
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally