Right, Right$, RightB, RightB$ (functions)

Syntax

Right[$](string, length)

RightB[$](string, length)

Description

Functions return the rightmost length for the following.

 

Function

Returns rightmost length for;

 

Right and RightB

Characters

 

RightB and RightB$

Bytes

Comments

Functions return the following.

 

Functions

Return

 

Right and RightB

String variant

 

Right$ and RightB$

String

 

These functions take the following named parameters:

 

Parameter

Description

 

string

String from which characters are returned. A runtime error is generated if string is NULL.

 

length

Integer specifying the number of characters or bytes to return as follows.

 

 

Length is

Returns

 

 

0

Zero-length string is returned.

 

 

Greater than or equal to the length of the string

String is returned.

 

 

The RightB and RightB$ functions are used to return byte data from strings containing byte data.

Example

'This example shows the Right$ function used in a routine to

'change uppercase names to lowercase with an uppercase first

'letter.

Sub Main()

    lname$ = "WILLIAMS"

    x = Len(lname$)

    rest$ = Right$(lname$,x - 1)

    fl$ = Left$(lname$,1)

    lname$ = fl$ & LCase$(rest$)

    MsgBox "The converted name is: " & lname$

End Sub

See Also

Left, Left$, LeftB, LeftB$ (functions)

More information

R