{{fbdoc item="title" value="STR"}}---- Returns a string representation of a number, boolean or Unicode character string {{fbdoc item="syntax"}}## [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgByte|byte]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgUbyte|ubyte]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgShort|short]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgUshort|ushort]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgLong|long]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgUlong|ulong]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgLongint|longint]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgUlongint|ulongint]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgSingle|single]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //n// [[KeyPgAs|as]] [[KeyPgDouble|double]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //b// [[KeyPgAs|as]] [[KeyPgBoolean|boolean]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Str** ( [[KeyPgByval|byval]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgWstring|wstring]] ) [[KeyPgAs|as]] [[KeyPgString|string]] ## {{fbdoc item="usage"}}## //result// = **Str**[$]( //number// ) //or// //result// = **Str**( //string// ) ## {{fbdoc item="param"}} ##//number//## Numeric expression to convert to a string. ##//string//## String expression to convert to a string. {{fbdoc item="desc"}} ##**Str**## converts numeric variables to their string representation. Used this way it is the ##[[KeyPgString|String]]## equivalent to ##[[KeyPgWstr|Wstr]]## applied to numeric variables, and the opposite of the ##[[KeyPgVal|Val]]## function, which converts a string into a number. ##**Str**## converts boolean variables to their string representation "false" / "true". ##**Str**## also converts Unicode character strings to ASCII character strings. Used this way it does the opposite of ##[[KeyPgWstr|Wstr]]##. If an ASCII character string is given, that string is returned unmodified. {{fbdoc item="ex"}} {{fbdoc item="filename" value="examples/manual/strings/str.bas"}}%%(freebasic) dim a as integer dim b as string a = 8421 b = str(a) print a, b %% {{fbdoc item="lang"}} - In the //[[CompilerOptlang|-lang qb]]// dialect, ##**Str**## will left pad a positive number with a space. - The string type suffix "$" is required in the //[[CompilerOptlang|-lang qb]]// dialect. - The string type suffix "$" is optional in the //[[CompilerOptlang|-lang fblite]]// dialect. - The string type suffix "$" is ignored in the //[[CompilerOptlang|-lang fb]]// dialect, warn only with the //[[CompilerOptw|-w suffix]]// compile option (or //[[CompilerOptw|-w pedantic]]// compile option). {{fbdoc item="target"}} - DOS version/target of FreeBASIC does not support the wide-character string version of ##**Str**##. {{fbdoc item="diff"}} - QB does not support the wide-character string version of ##**Str**##. {{fbdoc item="see"}} - ##[[KeyPgVal|Val]]## - ##[[KeyPgCbool|Cbool]]## - ##[[KeyPgChr|Chr]]## - ##[[KeyPgAsc|Asc]]## {{fbdoc item="back" value="CatPgCasting|Converting Data Types"}}{{fbdoc item="back" value="CatPgString|String Functions"}}