lang • left

Left$

Result = Left$ ( Arg AS String [ , Length AS Integer ] ) AS String Result = Left ( Arg AS String [ , Length AS Integer ] ) AS String

Returns the Length first characters of the string Arg.

If Length is not specified, the first character of the string is returned.

If Length is negative, all the string except the (- Length ) last characters is returned.

Left$ is optimized so that no string duplication occurs to generate the result.

This function only deals with ASCII strings. To manipulate UTF-8 strings, use the String.Left class.

Examples

Print Left$("Gambas", 4)
Gamb
Print Left$("Gambas")
G
Print Left$("Gambas", -1)
Gamba

See also