Home  |  Delphi .net Home  |  System.Globalization.TextElementEnumerator  |  Reset Method
Reset  
Method  
Move the current String position to before the first (0th) Text element
TextElementEnumerator Class
System.Globalization NameSpace
CF1.  Procedure Reset ( ) ;
CF : Methods with this mark are Compact Framework Compatible
Description
The current text element position (ElementIndex) is set to a position before the first (0 index) element. You must use MoveNext to restart processing.
Microsoft MSDN Links
System.Globalization
System.Globalization.TextElementEnumerator
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Globalization;

var
  enumerator : System.Globalization.TextElementEnumerator;
  myString   : String;
  myText     : String;
  i          : Integer;

begin
  myString := 'Hello';

  enumerator := StringInfo.GetTextElementEnumerator(myString);

  // Display the first 3 elements
  for i := 0 to 2 do
  begin
    enumerator.MoveNext;
    myText := enumerator.GetTextElement;
    Console.WriteLine(myText);
  end;

  // Reset to the start and show the whole string
  Console.WriteLine;

  enumerator.Reset;

  while enumerator.MoveNext do
  begin
    myText := enumerator.GetTextElement;
    Console.WriteLine(myText);
  end;

  Console.ReadLine;
end.
Show full unit code
  H
  e
  l
  
  H
  e
  l
  l
  o
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author