Is ReplaceStr() limited to 20 replacements?
Posted: Sat Jun 12, 2010 4:12 pm
Hi
Is there a limitation built into the ReplaceStr() function? If I replace characters at more than 20 locations in a string I get an error. The example below works and will read a single string to a file with newline characters between each number in raw format. Then, if I read from the file using ReadLine(), I get 21 lines of data back. But if I add ";21" to the string and thus has 21 ";" chars to replace with "\n" the ReplaceStr() function fails. As you can see from the code this was tested on the windows version of Hollywood.
txt$="start;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20"
txt$=ReplaceStr(txt$, ";", "\n")
OpenFile(2, "C:\\temp\\mintekst", #MODE_WRITE)
WriteString(2, txt$)
CloseFile(2)
OpenFile(1, "C:\\temp\\mintekst",#MODE_READ)
While Not Eof(1) Do NPrint(ReadLine(1))
CloseFile(1)
WaitLeftMouse
regards
jesper
Is there a limitation built into the ReplaceStr() function? If I replace characters at more than 20 locations in a string I get an error. The example below works and will read a single string to a file with newline characters between each number in raw format. Then, if I read from the file using ReadLine(), I get 21 lines of data back. But if I add ";21" to the string and thus has 21 ";" chars to replace with "\n" the ReplaceStr() function fails. As you can see from the code this was tested on the windows version of Hollywood.
txt$="start;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20"
txt$=ReplaceStr(txt$, ";", "\n")
OpenFile(2, "C:\\temp\\mintekst", #MODE_WRITE)
WriteString(2, txt$)
CloseFile(2)
OpenFile(1, "C:\\temp\\mintekst",#MODE_READ)
While Not Eof(1) Do NPrint(ReadLine(1))
CloseFile(1)
WaitLeftMouse
regards
jesper