Record TCastleStringIterator
Unit
Declaration
type TCastleStringIterator = record
Description
Iterate over String that contains Unicode characters suitable for both FPC (with default String = AnsiString) and Delphi (with default String = UnicodeString).
This should be used for all iteration over strings in Castle Game Engine. It abstracts away various details about UTF-8 processing (in case of FPC) and UTF-16 processing (in case of Delphi). See https://castle-engine.io/coding_conventions#strings_unicode .
The typical usage looks like this:
var Iter: TCastleStringIterator; begin Iter.Start('my_string'); while Iter.GetNext do begin // do something with Iter.Current now WritelnLog('Got Unicode character: %d, %s', [ Iter.Current, UnicodeCharToString(Iter.Current) ]); end; end;
It is allowed to use Start again, with the same iterator (regardless if it finished or not), to start processing a new (or the same) String.
Overview
Methods
procedure Start(const S: String); |
|
function GetNext: Boolean; |
Properties
property Current: TUnicodeChar read FCurrent; |
Description
Methods
procedure Start(const S: String); |
|
Start processing the given String. Must be called before accessing Current or GetNext. |
function GetNext: Boolean; |
|
Call this in a loop. Must be called (and return |
Properties
property Current: TUnicodeChar read FCurrent; |
|
After GetNext was called, and returned |
Generated by PasDoc 0.16.0-snapshot.