[Overview][Constants][Types][Procedures and functions] Reference for unit 'strutils' (#rtl)

MidStr

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

Declaration

Source position: line 0

function MidStr(

  const AText: AnsiString;

  const AStart: Integer;

  const ACount: Integer

):AnsiString;

function MidStr(

  const AText: WideString;

  const AStart: Integer;

  const ACount: Integer

):WideString;

Arguments

AText

  

String to copy characters from.

AStart

  

Position (in characters) to start copying from.

ACount

  

Number of characters to copy.

Function result

Resulting string

Arguments

AText

  

String to copy characters from.

AStart

  

Position (in characters) to start copying from.

ACount

  

Number of characters to copy.

Function result

Resulting string

Description

MidStrreturns a string containing the first ACountbytes from the string ATextstarting at position AStart. If AStart+ACountis larger than the length (in characters) of AText, only as many characters as available are returned. If AStartis less than 1 or larger than the length of AText, then no characters are returned.

This function is equivalent to the standard Copyfunction, and is provided for completeness only.

Errors

None.

See also

LeftStr

  

Copies Count characters starting at the left of a string.

AnsiMidStr

  

Returns a number of characters copied from a given location in a string

RightStr

  

Copy a given number of characters, counting from the right of a string.

MidBStr

  

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