Object TStringView
Unit
Declaration
type TStringView = object(TPcharView)
Description
A string view representing a subsequence of a string
See TPCharView and TPointerView for the general concept. TStringView keeps a reference to the original string, so it is fully memory safe.
For example, if you have a string '(123)', and want to convert the number between the parentheses to an integer, you can do:
var v: TStringView; number: integer; ok: boolean; begin v := '(123)'.view; ok := v.rightOfFind('('); ok := ok and v.leftOfFind(')'); ok := ok and v.toIntDecimalTry(number);
Hierarchy
- TObject
- TPointerView
- TPCharView
- TStringView
Overview
Nested Types
![]() |
TSplitOptions = (...); |
![]() |
TStringViewArray = array of TStringView; |
Methods
![]() |
procedure init(const buffer: string); reintroduce; |
![]() |
function viewLeftWith(newLast: pchar): TStringView; reintroduce; |
![]() |
function viewLeftOf(newEnd: pchar): TStringView; reintroduce; |
![]() |
function viewRightWith(newStart: pchar): TStringView; reintroduce; |
![]() |
function viewRightOf(newStartSkip: pchar): TStringView; reintroduce; |
![]() |
function splitAt(out before: TStringView; element: PChar; out behind: TStringView): boolean; |
![]() |
function splitLeftOf(element: PChar; out behind: TStringView): boolean; |
![]() |
function splitRightOf(out before: TStringView; element: PChar): boolean; |
![]() |
function splitAtFind(out before: TStringView; searched: pchar; searchedLength: SizeInt; out behind: TStringView): boolean; |
![]() |
function splitLeftOfFind(searched: pchar; searchedLength: SizeInt; out behind: TStringView): boolean; |
![]() |
function splitRightOfFind(out before: TStringView; searched: pchar; searchedLength: SizeInt): boolean; |
![]() |
function splitAtFind(out before: TStringView; const searched: string; out behind: TStringView): boolean; |
![]() |
function splitLeftOfFind(const searched: string; out behind: TStringView): boolean; |
![]() |
function splitRightOfFind(out before: TStringView; const searched: string): boolean; |
![]() |
function splitFindToArray(const sep: string; options: TSplitOptions = soNone): TStringViewArray; |
Description
Nested Types
![]() |
TSplitOptions = (...); |
Values
| |
![]() |
TStringViewArray = array of TStringView; |
Methods
![]() |
procedure init(const buffer: string); reintroduce; |
|
Creates a view for a string. | |
![]() |
function viewLeftWith(newLast: pchar): TStringView; reintroduce; |
|
copy and leftWith. | |
![]() |
function viewLeftOf(newEnd: pchar): TStringView; reintroduce; |
|
copy and leftOf. | |
![]() |
function viewRightWith(newStart: pchar): TStringView; reintroduce; |
|
copy and rightWith. | |
![]() |
function viewRightOf(newStartSkip: pchar): TStringView; reintroduce; |
|
copy and rightOf. | |
![]() |
function splitAt(out before: TStringView; element: PChar; out behind: TStringView): boolean; |
|
Splits the view at element. Everything before element is returned in before, everything behind it in behind. self is unchanged. | |
![]() |
function splitLeftOf(element: PChar; out behind: TStringView): boolean; |
|
Splits the view at element. Everything before element is returned in self, everything behind it in behind. | |
![]() |
function splitRightOf(out before: TStringView; element: PChar): boolean; |
|
Splits the view at element. Everything before element is returned in before, everything behind it in self. | |
![]() |
function splitAtFind(out before: TStringView; searched: pchar; searchedLength: SizeInt; out behind: TStringView): boolean; |
|
Splits the view at the first occurrence of searched. Everything before searched is returned in before, everything behind (searched+searchedLength) in behind. Self is unchanged. | |
![]() |
function splitLeftOfFind(searched: pchar; searchedLength: SizeInt; out behind: TStringView): boolean; |
|
Splits the view at the first occurrence of searched. Everything before searched is returned in self, everything behind (searched+searchedLength) in behind. | |
![]() |
function splitRightOfFind(out before: TStringView; searched: pchar; searchedLength: SizeInt): boolean; |
|
Splits the view at the first occurrence of searched. Everything before searched is returned in before, everything behind (searched+searchedLength) in self. | |
![]() |
function splitAtFind(out before: TStringView; const searched: string; out behind: TStringView): boolean; |
|
Splits the view at the first occurrence of searched. Everything before searched is returned in before, everything behind (searched+searchedLength) in behind. Self is unchanged. | |
![]() |
function splitLeftOfFind(const searched: string; out behind: TStringView): boolean; |
|
Splits the view at the first occurrence of searched. Everything before searched is returned in self, everything behind searched in behind. | |
![]() |
function splitRightOfFind(out before: TStringView; const searched: string): boolean; |
|
Splits the view at the first occurrence of searched. Everything before searched is returned in before, everything behind searched in self. | |
![]() |
function splitFindToArray(const sep: string; options: TSplitOptions = soNone): TStringViewArray; |
Generated by PasDoc 0.16.0.

