[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
StringSplit
This function returns the p-th part of a string, separated by the separator parameter. This turns the Source-string into a 0-indexed array of substrings.
function StringSplit(Source: string; p: integer; separator: char): string;
var
  i: integer;
  s,s1: string;
begin
  s:= Source + separator;
  for i := 0 to p do begin
    s1 := Copy(s, 1, Pos(separator, s)-1);
    s := Copy(s, Pos(separator, s)+1, Length(Source));
  end;
  Result := s1;
end;


last edited (January 25, 2004) by zibadian, Number of views: 1266, Current Rev: 1

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.