Stringify

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > String functions >

Stringify

 

Description

 

Return piece of script source code as typed by programmer.

Useful, for example, when writing JSON objects and do not want to double double quote

 

Syntax

 

s = Stringify(

                 Code_Expression

         )

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

Code_Expression

Code

No

Any piece of code

 

Remarks

 

Restrictions

 

IMPORTANT: open ( and close ) MUST be on a new line by themselves. Code_Expression MUST be inside () but always in different lines.

 

Correct:

s = Stringify(

                 {...}

         )

 

Incorrect:

s = Stringify( {...}

         )

 

Incorrect:

s = Stringify(

         {...} )

 

Incorrect:

s = Stringify( {...} )

 

 

See also

 

Examples

 

 

 

string s = Stringify(

                         {

                                 "model": "gpt-3.5-turbo",

                                 "messages": [

                                         {"role": "system", "content": "About thinBasic"},

                                         {"role": "user", "content": "Do you know thinBasic programming language?"}

                                 ]

                         }

                 )