[clean-list] Terminating strings
Siegfried Gonzi
siegfried.gonzi@kfunigraz.ac.at
Wed, 05 Sep 2001 12:14:14 +0200
I have to deal with the following datas:
12.34 12.34 54.33
23.45 23.45 23.34
56.3 133.3 00.443
999
34.55 23.34 232.34
45.6 23.34 67.67
And I want that the read process aborts at the line "999":
CountLines:: !File -> !Int
CountLines file = ReadLines 0 file
where
ReadLines:: !Int !File -> !Int
ReadLines nLines file
| line == "999" = abort("999 reached")
#! (line,filerest) = sfreadline file
= ReadLines (nLines + 1) filerest
but it doesn't treminate. If I print out to the console the "line", then I get
("999",65...). StdFile says that sfreadline also reads the newline delimiter. But I
couldn't, in the complete Clean manuals, find the sign for the newline. Maybe I have to
include this mark for my string comparison:
line == "999" = abort...
I also tried:
toString(line) == "999" = abort...
But then I get the error message toString requires a "*" at the indicated position but
doesn't get it.
Any help appreciated,
S. Gonzi