Delphi: Caption on Text label to string array?
Posted by Steve Learn on November 19, 2003 at 05:11:36:
Hi i'm attempting to write a program which takes a word and prints all the permutations for it. I have an algorithm but i'm stuck trying to convert a editbox.text caption to an array.
this is what I have so far:
Const Max = 20; Type StringType = packed array [1..Max] of char; var TheString: Stringtype;
procedure TForm1.StartClick(Sender: TObject); var mystring: string[max]; counter : integer; begin mystring := copy(WordEnter.Text,1,1); while (length(WordEnter.Text) < MAX) do begin counter := counter + 1; StringType(counter) := mystring(counter); end;
I enter a word in a text box then start.click should parse each letter into a single array element but I get the invalid typecast error?
If anyone can tell me how to convert text to an array I would be grateful thanks...
[ DelphiLand: free Delphi source code, tips, tutorials ]