Logo

Programming-Idioms

History of Idiom 49 > diff from v18 to v19

Edit summary for version 19 by :
[Pascal] Proper import

Version 18

2016-01-26, 02:30:59

Version 19

2016-02-07, 17:39:29

Idiom #49 Split a space-separated string

Build list chunks consisting in substrings of input string s, separated by one or more space characters.

Idiom #49 Split a space-separated string

Build list chunks consisting in substrings of input string s, separated by one or more space characters.

Imports
Classes
Imports
Uses Classes;
Code
var
  SL: TstringList;
begin
  //assume the list is created (and freed at some later point)
  SL.StrictDelimiter := True;
  SL.Delimiter := #32; //#32 is space char
  SL.DelimitedText := 'Text containing several spaces   !';
end; 
Code
var
  SL: TstringList;
begin
  //assume the list is created (and freed at some later point)
  SL.StrictDelimiter := True;
  SL.Delimiter := #32; //#32 is space char
  SL.DelimitedText := 'Text containing several spaces   !';
end;