CStr Function

Converts any numeric expression to a string expression.

Notkun:

CStr (Expression)

Skilagildi:

String

Viðföng:

Expression: Any valid string or numeric expression that you want to convert.

Expression Types and Conversion Returns

Boole gildi :

String that evaluates to either True or False.

Dagsetning :

String that contains the date and time.

Null :

Run-time error.

Tómur :

String without any characters.

Hvern sem er :

Corresponding number as string.


Zeros at the end of a floating-point number are not included in the returned string.

Error codes:

5 Ógilt kall á stefju

Dæmi:

Sub ExampleCSTR

Dim sVar As String

    MsgBox CDbl(1234.5678)

    MsgBox CInt(1234.5678)

    MsgBox CLng(1234.5678)

    MsgBox CSng(1234.5678)

    sVar = CStr(1234.5678)

    MsgBox sVar

End Sub