String Manipulation Statements & Functions

 

 

Function

What it Does

Comments

Asc(string)

Returns an Integer value corresponding to the ASCII code for the first character of string

 

Chr(charcode)

Returns a one-character String that represents the ASCII character of the number specified by charcode

 

Cstr()

 

See Entry in Conversion Functions

Instr([start, ] _ string1, string2 _

[,compare])

Returns a Variant specifying the starting position of the first occurrence of a substring (string2) within another string (string1).

 

(optional) start specifies from which character in string2 to start searching; the default is 1, the 1st character). (optional) compare indicates the string comparison that to be made (0 = binary or 1 = non-case-sensitive text).

InstrRev(string1, _ string2[,start[,compare]]))

Searches for a substring (string2) within a string (string1) and returns the position of that substring from the end of the string

The compare agrument can take on the following values: vbUseCompareOption, vbBinaryCompare, vbTextCompare, vbDatabaseCompare,

Left(string, length)

Returns a String value that s length characters long, taken from the left side of string.

 

LCase (string)

Returns string as all lower case

Good for reducing the number of string comparisons that might need to be made against user text input strings

Len(string|varname)

Determines the length of a string (string) or numeric (varname)

 

LSet stringvarstring

Assigns a string value to a String variable (stringvar), left-aligning the string to the String variable.

 

LSet varname1=varname2

Copies a variable (varname2) from one user-defined type (UDT) to a variable (varname1) in another user-defined type (UDT).

 

LTrim (string)

Returns a Variant containing a copy of string with any leading spaces removed.

 

Mid(string, start [,length])

Returns a String of one or more characters (as determined by the startposition and length parameters), taken from string. 

startspecifies the position within string where the new String is to be obtained, and (optional) length specifies how many characters are to be taken from string. If no length is specified, then the entire string (starting at the position by start) is used.

Mid(stringvarstart[,length])= _ string

Replaces one or more characters in a String variable (stringvar) with string.

 

startspecifies the position within stringvar to place the new string, and (optional) length specifies how many characters of string should be used. If no length is specified, then the entire string is used.

Right(string, length)

Returns a String value length characters long taken from the right side of string.

 

RSet stringvar= string

Assigns a string value to a String(stringvar), right-aligning the string to theString.

 

RTrim (string)

Returns a Variant containing string with any trailing spaces removed.

 

Space(number)

Returns a Variant containing a number of spaces.

 

Str(number)

 

See Entry in Conversion Functions

StrComp(string1string2[, _ compare])

 

Returns a Variant containing the result of a comparison between two strings (string1 and string2).

 

(optional) compare specifies how strings are to be compared, with 0 = binary comparison and 1 = a non-case-sensitive text comparison.

StrConv (string, conversion)

Returns a Variant, converted from string as specified by conversion.

 

conversion uses a VB constants to specify the type of conversion, such as vbUpperCase,vbLowerCase, and vbProperCase.

String(number, character)

 

Returns a Variant of the length specified by number and is filled with a given character

StrReverse(string1)

Returns a string in which the order of the characters is reversed

If string1 is a zero length string, a zero length string is returned. If string1 is Null, an error occurs.

TypeName(varname)

Returns a String indicating the data type of a given variable (varname).

Possible return values are:

Byte, Integer, Long, Single, Double, Currency, Decimal, Date, String, Boolean, Error, Empty, Null, Object, Unknown, Nothing, or an Object.

Trim(string)

Returns a Variant containing string with any leading and trailing spaces removed.

 

UCase(string)

Returns string as all upper case

Good for reducing the number of string comparisons that might need to be made against user text input strings

Val()

 

See Conversion Functions

Go Back to Top

arrowl2Return to the Visual Basic 6 Commands & Functions Page

Comments

 

Latest Version! NetObjects Fusion 10 

 

Copyright 1998 Rich Hamper 

All Rights Reserved

 

Last Updated:

Sunday, January 20, 2008