diff --git a/src/ce_stringrange.pas b/src/ce_stringrange.pas index b3cde56e..33415dd8 100644 --- a/src/ce_stringrange.pas +++ b/src/ce_stringrange.pas @@ -86,6 +86,12 @@ type function startsWith(const value: string): boolean; {$IFNDEF DEBUG}inline;{$ENDIF} // indicates wether the range starts with value. function startsWith(var value: TStringRange): boolean; {$IFNDEF DEBUG}inline;{$ENDIF} + // indicates wether the range ends with value. + function endsWith(const value: string): boolean; {$IFNDEF DEBUG}inline;{$ENDIF} + + + // read-only position + function position: integer; end; implementation @@ -122,6 +128,11 @@ begin len := length(str); end; +function TStringRange.position: integer; +begin + Result := pos; +end; + function TStringRange.init(const pchr: PChar; length: integer): PStringRange; begin ptr := pchr; @@ -320,5 +331,13 @@ begin value.pos := p1; end; +function TStringRange.endsWith(const value: string): boolean; +begin + if empty then + Result := false + else + Result := ptr[pos .. length(value)-1] = value; +end; + end.