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

# MidBStr

Copies a number of characters starting at a given position in a string.

## Declaration

Source position: strutils.pp line 90

`function MidBStr(`
`const AText: AnsiString;`
`const AByteStart: SizeInt;`
`const AByteCount: SizeInt`
`):AnsiString;`

## Arguments

`AText` |  | String to copy characters from.
`AByteStart` |  | Position (in bytes) to start copying from.
`AByteCount` |  | Number of characters (bytes) to copy.

## Function result

Resulting string

## Description

MidBStr returns a string containing the first AByteCount bytes from the string AText starting at position AByteStart. If AByteStart+AByteCount is larger than the length (in bytes) of AText, only as many bytes as available are returned. If AByteStart is less than 1 or larger than the length of AText, then no characters are returned.

## Errors

None.

## See also

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