## Pundia Newbie Poster

Hi people, I'm trying to make a program that reads and counts words and their frequency. After a few days trying I just make the program read a text, counts the words and everything BUT just if there's no more than one ' ' space character at a time. And for the line break (because that's two characters) I did a little trick (I'm really not proud of it).
My teacher recommend me to read the text line by line. How can I do this from a memo? This would take off the line break problem, but then... how can I solve the thing about the space character? I've tried a lot of things, and I'm new with Delphi and at programming, any help is apreciated! Thanks!

Code so far:

``````begin
someText := memo_txtfile.text;
oneWord := '';

s := TStringList.Create;
for i := 1 to length(someText) do begin
aux:=ord(someText[i]);

if aux=10 then begin end else begin

if aux<33 then begin

idxFound := s.indexof(oneWord);

if idxFound >= 0 then begin
iCount := integer(s.objects[idxFound]);
s.Objects[idxFound] := TObject(iCount + 1);
end
else begin

end;
oneWord := '';
end
else begin
oneWord := oneWord + someText[i];
end;
end;
end;

if oneWord <> '' then
begin
idxFound := s.indexof(oneWord);
end;
if idxFound >= 0 then begin
iCount := integer(s.objects[idxFound]);
s.Objects[idxFound] := TObject(iCount + 1);
end
else begin
end;
grid.RowCount:=s.Count+1;
// put the results on the screen in a stringgrid.

quicksort(s, 0, s.Count-1);
for i := 0 to s.Count - 1 do begin
grid.Cells[0,i+1]:= intToStr(i+1) + '.-';
grid.cells[1,i+1] := s[I];
grid.Cells[2,i+1] := intToStr(integer(s.Objects[i]));
end;
end;``````

## Pundia

Solved how to read line by line. Now I keep not knowing the thing about the space character.

## Pundia

Solved, may upload results to blog. Thanks anyway.