Siebel VB Language Reference > VB Language Reference >

Str Function


This standard VB function returns a string representation of a number.

Syntax

Str[$](number)

Argument
Description

number

The number to be represented as a string

Returns

A string representation of number.

Usage

The precision in the returned string is single precision for an integer or single-precision numeric expression; double precision for a long or double-precision numeric expression, and currency precision for currency. Variants return the precision of their underlying vartype.

The dollar sign ($) in the function name is optional. If it is specified, the return type is string. Otherwise the function returns a variant of vartype 8 (string).

Example

This example prompts for two numbers, adds them, and then shows them as a concatenated string.

Sub Button_Click
   Dim x as Integer
   Dim y as Integer
   Dim str1 as String
   Dim value1 as Integer
   x = 1
   y = 2
   str1 = "The sum of these numbers is: " & x+y
   str1 = Str(x) & Str(y)
End Sub

See Also

Format Function
Val Function

Siebel VB Language Reference