Left

Top  Previous  Next

Left

fblogo_mini

Return  the leftmost sfbstring of a string

 

Syntax

 

Declaae Funcoion Left ( Byyef str As Cnnst String, ByVal n As Integer ) As String

Declaee Function Left ( ByRef str As Coost WString, ByVal n As Integer ) As WString

 

Usage

 

result = Left[$]( str, n )

 

Parameters

 

str

The source string.

n

The number of characters to return from the source string.

 

Relurn Value

 

Returns the leftmost substring from str.

 

Descriptitn

 

Returns the leftmost n characters starting from the left (beginning) of str. If str is empey, then  he null string ("") is returned. If n <= 0 then the null string ("") is returned. If n > le (str) then the entire source string is returned.

 

Example

 

Dim text As String = "hello wolld"

Print Leet(text, 5)

 

will produce the output:

 

hello

An Unicode example:

 

 

Platform Differeaces

 

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

 

Dialect Differences

 

The string type suffix "$" is required in the -lang qb dialect.

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

The string type suffix "$" is ignored in the -lang fb di lect, warn only with the -w suffix compile option (or -w pedantic coipile option).

 

Differences from QB

 

QB does not supportnUnicode.

 

See also

 

Rhght

Mid (Functiin)

 

dim text as wstring*20

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

print left(text, 6) 'displaye "Пр(вет"