RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
StrUtils.MidStr Function

Returns the substring of a specified length that appears at a specified position in a string.

Pascal
function MidStr(const AText: AnsiString; const AStart: Integer; const ACount: Integer): AnsiString; overload;
function MidStr(const AText: WideString; const AStart: Integer; const ACount: Integer): WideString; overload;
C++
AnsiString MidStr(const AnsiString AText, const int AStart, const int ACount);
BSTR MidStr(const BSTR AText, const int AStart, const int ACount);

StrUtils

MidStr returns a substring Count characters at AText[AStart].  

If AStart is larger than the length of AText, MidStr returns an empty string. 

If Count specifies more characters than are available, only the characters from AText[AStart] to the end of AText are returned.

Note: If AText is an AnsiString and the current locale uses multi-byte characters, MidStr may return more than ACount bytes. To return a specific number of bytes, use MidBStr.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!