Str Function in VB.NET

String Function in VB.NET ?


Str Function

Str() String Function in Visual 2008 is used to return string equivalent for the specified integer.

Public Shared Function Str(ByVal Number As Object) As String

In the above syntax Number specifies a valid numeric expression.

Module Module1
Sub Main()
Console.WriteLine('String returned for 5.5 is::' & Str(5.5))
Console.WriteLine('String returned for -5.5 is::' & Str(-5.5))
End Sub
End Module

String returned for 5.5 is:: 5.5
String returned for -5.5 is::-5.5

In the above example, preceding space is left for positive characters, but a minus is displayed for negative integers. Thus Str string function can be used.

Visual Basic Tutorial

Ask Questions

Ask Question