ProgrammerGuide.Net | Step by Step Programmer Guide

Vb-String

String,

Left and Right functions
Returns a Variant (String) containing a specified number of characters from the right side of a string.
Syntax : Left(string, length) | Right(string, length)

Example:
dim AnyString, MyStr
AnyString = “Hello World” ‘ Define string.
MyStr = Right(AnyString, 1) ‘ Returns “d”.
MyStr = Right(AnyString, 6) ‘ Returns ” World”.
MyStr = Right(AnyString, 20) ‘ Returns “Hello World”.

PartDescription
StringRequired. String expression from which the rightmost characters are returned. If string contains Null,Null is returned
LengthRequired; Variant (Long). Numeric expression indicating how many characters to return. If 0, a zero-length string (“”) is returned. If greater than or equal to the number of characters in string,the entire string is returned.

Asc functions
Returns an Integer representing the character code corresponding to the first letter in a string.
Syntax:
Asc(string)

Example:
Dim MyNumber
MyNumber = Asc(“A”) ‘ Returns 65.
MyNumber = Asc(“a”) ‘ Returns 97.
MyNumber = Asc(“Apple”) ‘ Returns 65.

Base 0 & 1
Option Base {0 | 1}.

Because the default base is 0, the Option Base statement is never required. If used, the statement must appear ina module before any procedures. Option Base can appear only once in a module and must precede arraydeclarations that include dimensions.The Option Base statement only affects the lower bound of arrays in the module where the statement is located

Example:
Dim iNumber(15 To 114) As Integer.

Chr Function
Returns a String containing the character associated with the specified character code.The required charcode argument is a Long that identifies a character.

Syntax:
Chr(charcode)

Example:
Dim MyChar
MyChar = Chr(65) ‘ Returns A.
MyChar = Chr(97) ‘ Returns a.
MyChar = Chr(62) ‘ Returns >.
MyChar = Chr(37) ‘ Returns %.

FormatCurrency, FormatPercent, FormatNumber
Syntax.
FormatCurrency(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit
[,UseParensForNegativeNumbers [,GroupDigits]]]])
FormatPercent(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers
[,GroupDigits]]]]) FormatNumber(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit
[,UseParensForNegativeNumbers [,GroupDigits]]]])

PartDescription
ExpressionRequired.Expression to be formatted.
NumDigitsAfterDecimalOptional.Numeric value indicating how many places to the right of the decimal are displayed. Default value is –1,whichindicates that the computer’s regional settings are used
IncludeLeadingDigitOptional.Tristate constant that indicates whether or not aleading zero is displayed for fractional values. See Settings section for values
Use Parents For (-)NoOptional.Tristate constant that indicates whether or not place negative values within parentheses. See Setting section for values.
Please click here for related products on Amazon!

Jayashee

Add comment

Want to Check Celebrities News?