README.md
December 4, 2022 · View on GitHub
Description
Hey this function just emulates the Visual Basic function that we know and love “split”!!! You use it the same way you would have in vb.
avar := split('string to break up',' ',2);
That will return avar as “to” that’s it, have fun and please vote!!
More Info
| Submitted On | |
| By | Nick Siderakis |
| Level | Intermediate |
| User Rating | 4.5 (36 globes from 8 users) |
| Compatibility | Delphi 5, Delphi 4, Pre Delphi 4 |
| Category | String Manipulation |
| World | Delphi |
| Archive File |
Source Code
<pre><fontsize=2>function split(input:string;schar:char;s:integer):string;
var
i,n:integer;
schop: string;
begin
n := 1;
for i := 1 to length(input) do
begin
if (input[i] = schar) then
begin
inc(n);
if n = s then
split := schop
else
schop := '';
end
else
schop := schop + input[i];
end;
end;</pre>