I have a text file with a list of numbers...
1,2,4,13, etc.
I want to delete the last number.
Can't see a command "go to EOF" or similar except
"read from file myfile until EOF" which seems like going
the long way around.
Also need to delete from EOF to the character before the
next "," which might mean deleting two or three characters
depending on the last number.
Beginners Questions
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
bjb, this is how I'd do it:
the 'url' syntax lets the engine take care of actually open/reading/writing/closing the file, and 'item' is one of Revolution's chunk expressions - have a look at the entries for 'item', 'word' and 'line' in the docs.
Two important things to know about Revolution:
1: Chunk expressions tend to be very efficient.
2: Pass whatever work you can to the engine because it tends to be very efficient.
Best,
Mark
Code: Select all
put url ("file:" & myFile) into myData
delete item -1 of myData
put myData into url ("file:" & myFile)
the 'url' syntax lets the engine take care of actually open/reading/writing/closing the file, and 'item' is one of Revolution's chunk expressions - have a look at the entries for 'item', 'word' and 'line' in the docs.
Two important things to know about Revolution:
1: Chunk expressions tend to be very efficient.
2: Pass whatever work you can to the engine because it tends to be very efficient.
Best,
Mark
More simple questions
Thanks Mark. That works fine.
Now I want to get a number from the same file and display
it on the form. Don't want it to be editable.
Expect that if I use a grid and make it non-editable I won't
be able to change the number displayed programmatically.
(Revision: found a reference which says that it can still be
edited programmatically.)
Can't see anything specifically for that but could use a label
I guess. What's the best way to do this?
Tried a Table Field but can't put into one cell. Setting
format to 'centre' puts into middle of three, 'left' puts
into left. Need a way to address one 'cell' of three.
Tried as for an array [1], [1,1] etc. but doesn't work.
Now I want to get a number from the same file and display
it on the form. Don't want it to be editable.
Expect that if I use a grid and make it non-editable I won't
be able to change the number displayed programmatically.
(Revision: found a reference which says that it can still be
edited programmatically.)
Can't see anything specifically for that but could use a label
I guess. What's the best way to do this?
Tried a Table Field but can't put into one cell. Setting
format to 'centre' puts into middle of three, 'left' puts
into left. Need a way to address one 'cell' of three.
Tried as for an array [1], [1,1] etc. but doesn't work.