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 ReplaceStr() limited to 20 replacements?
- TheMartian
- Posts: 109
- Joined: Sun Feb 28, 2010 12:51 pm
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Is ReplaceStr() limited to 20 replacements?
This is a bug in Hollywood which was already discovered earlier by Paul Bloedel. It will work correctly in the next version
- TheMartian
- Posts: 109
- Joined: Sun Feb 28, 2010 12:51 pm
Re: Is ReplaceStr() limited to 20 replacements?
Hi
Ok. Sounds good. I was thinking of using it to build strings making up a complete data block for small databases and save it with 'inbuilt' newline characters as terminators instead of doing multiple writes in a loop. The reverse process would then be either reading data using ReadLine() or read in the entire block and splitting it as discussed in another subject on these pages.
regards
Jesper
Ok. Sounds good. I was thinking of using it to build strings making up a complete data block for small databases and save it with 'inbuilt' newline characters as terminators instead of doing multiple writes in a loop. The reverse process would then be either reading data using ReadLine() or read in the entire block and splitting it as discussed in another subject on these pages.
regards
Jesper