[Overview][Resource strings][Constants][Types][Procedures and functions][Index] | Reference for unit 'StrUtils' (#rtl)

# AnsiLeftStr

Copies a number of characters starting at the left of a string

## Declaration

Source position: strutils.pp line 91

`function AnsiLeftStr(`
`const AText: AnsiString;`
`const ACount: SizeInt`
`):AnsiString;`

## Arguments

`AText` |  | String to copy characters from.
`ACount` |  | The number of characters to copy.

## Function result

Resulting string contains the first ACount characters

## Description

AnsiLeftStr returns the ACount leftmost characters from AText. If ACount is larger than the length of AText, only as much characters as available in AText will be copied. If ACount is zero or negative, no characters will be copied. The characters are counted as characters, not as Bytes.

This function corresponds to the Visual Basic LeftStr function.

## Errors

None.

## See also

AnsiMidStr |  | Returns a number of characters copied from a given location in a string
AnsiRightStr |  | Copies a number of characters starting at the right of a string
LeftStr |  | Copies Count characters starting at the left of a string.
RightStr |  | Copy a given number of characters, counting from the right of a string.
MidStr |  | Copies a number of characters starting at a given position in a string.
LeftBStr |  | Copies Count characters starting at the left of a string.
RightBStr |  | Copy a given number of characters (bytes), counting from the right of a string.
MidBStr |  | Copies a number of characters starting at a given position in a string.

Documentation generated on: May 14 2021