CChar Function

   
CChar Function

Named Arguments

No

Syntax

 CChar(   expression   ) 
expression (required; String)

Any string expression

Return Value

A value of type Char

Description

Converts the first character in a string expression to a Char data type

Rules at a Glance

CChar extracts the first character of expression and converts it to a Char data type.

Example

 MsgBox(CChar("abc"))      ' Displays a MsgBox(CChar("56"))       ' Displays 5 

Programming Tips and Gotchas

  • If you wish to convert a numeric code to its corresponding Char data type, use the ChrW function.

  • Like most of the conversion functions, CChar is not actually a function in the Microsoft.VisualBasic namespace. Instead, it is similar to a Visual C++ macro; the compiler translates the function call into inline code.

See Also

Chr, ChrW Functions

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net