SRL Archive - OSR Help

Make a string into an array


xxpoopyxx

2013-03-12 21:19:16

how would i take a string that is a sentence and has spaces, and convert it into an array splitting the words by spaces.

or see if the first word in the sentence is contained in the array, then the second word in the second array and so on!

Sin

2013-03-12 21:30:42

Uhh try ExplodeWrap(); or ImplodeWrap();, i'm not too sure which one it is >_<

xxpoopyxx

2013-03-12 21:47:00

not sure how to use this but i will look into it

Le Jingle

2013-03-12 22:20:34


{$include_once srl/srl.simba}
var
s: string;
TSA: TStringArray;
begin
SetupSRL;
s := 'hellow world';
TSA := Explode(' ', s);
Writeln(TSA);
end.
Note the original function:

Explode(del: string; str: string): TStringArray;
del: string is your delimiter in which marks where to break the string, str, up into pieces, resulting in a TStringArray, TSA.

xxpoopyxx

2013-03-12 23:43:07

Thanks for everyone's help especially le jingle

Zorgatone

2013-03-12 23:44:53

From: Le Jingle

{$include_once srl/srl.simba}
var
s: string;
TSA: TStringArray;
begin
SetupSRL;
s := 'hellow world';
TSA := Explode(' ', s);
Writeln(TSA);
end.
Note the original function:

Explode(del: string; str: string): TStringArray;
del: string is your delimiter in which marks where to break the string, str, up into pieces, resulting in a TStringArray, TSA.


+1 :D I like this way to work with strings