1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

ExtractStrings

unit
Classes
category
string handling routines

declaration
type TSysCharSet = set of Char;
function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings): Integer;

description
Fills a string list with substrings parsed from a delimited list.

Separators is a set of characters that are used as delimiters, separating the substrings, where Carriage returns, newline characters, and quote characters (single or double) are always treated as separators. WhiteSpace is a set of characters to be ignored when parsing Content if they occur at the beginning of a string. Content is the null-terminated string to parse into substrings. Strings is a string list to which all substrings parsed from Content are added. The function returns the number of strings added to the Strings parameter.

example
//example 1 - requires TMemo named "Memo1"

ExtractStrings([';',','], 
               [' '], 
               'about: delphi; pascal, programming ', 
               memo1.Lines);
//would result in 3 strings added to memo:
//about: delphi
//pascal
//programming

//example 2
ExtractStrings([DateSeparator], [' '], 
               PChar(DateToStr(Now)), memo1.Lines);
//would result in 3 strings: day month and year of the currnet date
//for example '06', '25' ,'2003'

in real code
String Types in Delphi
Understanding and managing string data types in Delphi's Object Pascal. Learn about differences between Short, Long, Wide and null-terminated strings.
Ordinal and Enumerated Data Types
Learn about Delphi's support for ordinal types. Extend Delphi's built-in types by constructing your own types.

see also
LastDelimiter, IsPathDelimiter


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.