Gambas Documentation - /lang/left

/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 deal with ASCII strings. To manipulate UTF-8 strings, use the String class.

### Examples

    PRINT Left$("Gambas", 4)

    Gamb

    PRINT Left$("Gambas")

    G

    PRINT Left$("Gambas", -1)

    Gamba

### See also

- String Functions