- How to convert Variables to String with Str()
  - The Program
  - The Code:
  - The Source

# How to convert Variables to String with CStr() and Str()

You can use Str() or CStr() to convert a variable to String.
Str() uses your language enviroment, which is defined by LANG (shell: echo $LANG)
CStr() does not.
My language enviroment is German:

    jochen@archie:~$ echo $LANG
    de_DE@euro

In the screenshot you see the result of Str(4.6), which is 4,6.
The comma is set, because that's the way a decimal number is written in Germany.

## The Program

## The Code:

    STATIC PUBLIC SUB Main()
      hForm AS Fmain
      hForm = NEW Fmain
      hForm.show
    END

    PUBLIC SUB Button1_Click()
       Label2.Text = Str(4.6)
       Label4.Text = CStr(4.6)
       Label6.Text = Str(23456)
       Label8.Text = CStr(23456)
       Label10.Text = Str(TRUE)
       Label12.Text = CStr(TRUE)
    END

## The Source

Download