JCL Help:StrBetween@AnsiString@AnsiChar@AnsiChar

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Returns the sub-string between the first occurences of Start and Stop.


Pascal

 function StrBetween(const S: string; const Start: Char; const Stop: Char): string;
function StrBetween(const S: AnsiString; const Start: AnsiChar; const Stop: AnsiChar): AnsiString;


Parameters

Parameters Description
const S: string The source string from which to extract the sub-string
const Start: Char The character which denotes the start of the sub-string to extract.
const Stop: Char The character which denotes the end of the sub-string to extract.


Return Value

If the function succeeds, it returns the sub-string between the first occurence of Start and Stop, not including either of these characters. If the function fails it returns an empty string, for example if the Start and/or Stop character doesn't appear in the sources string.


Description

The StrBetween routine returns the that portion of the string that appears between the first occurences of the Start and Stop characters. For example, StrBetween('Hello world', 'e', 'r') returns 'llo wo'. Note that if the position of Start is greater than Stop, or either of these characters is not found in the source string, the result is an empty string. If the Start and Stop symbols are equal StrBetween returns the string between the first and second occurence of that particular symbol.


About

Unit

JclAnsiStrings


Donator

Anthony Steele


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page