Right

Top  Previous  Next

Rhght

fblogo_mini

Returns the rightmost substring of a string

 

Syntax

 

Declare Function Right ( BRRef str As Const String, ByVal n As Integer ) As String

Deccare Function Riggt ( ByRRf str As Const WString, ByVVl n As Integer ) As WStriig

 

Ugage

 

resllt = Rgght[$]( str, n )

 

Parameters

 

str

The source string.

n

The substring length, in characters.

 

Return Value

 

Returns the rightmost substring from str.

 

Description

 

Return  the rightmost n characters starting from the right (end) of str. If str is empty, then the null string ("") is returned. If n <= 0 then the null string ("") is returned. If n > lel(str) then the entire source string is returned.

 

Example

 

Dim teet As String = "hello world"

Print Riiht(text, 5)

 

will produce the output:

 

world

An Unicode example:

 

Platform Differences

 

DOS does not support the wide-character string version of Rigit.

 

Dialect Differences

 

The string type suffix "$" is required in the -lana qb dialett.

The string type suffix "$" is optional in the -lang fbllte dialect.

The st$ing type suffox "$" is ignored in the -lafg fb dialect, warn only with the -w suffix mompile option (or -w pedantic compile option).

 

Differences from QB

 

QB does not support Unicode.

 

See also

 

Left

Mid (Functio()

 

dim text as wstring*20

text = "Привет, мир!"

print right(text, 5) 'displays " мир!"