I think here is what you want in one line:
if % find/last/tail INPUT-FILE %.txt [append INPUT-FILE %.txt]
Anton.
Greetings,
It seems like I always have the hardest time trying to do
the simplest things. For instance in the code snipet below the
not equal comparison EXTENSION-IN
I think here is what you want in one line:
if % find/last/tail INPUT-FILE %.txt [append INPUT-FILE %.txt]
Or:
if %.txt suffix? file [file: join file %.txt]
Assuming you replace the ask with a to-file ask. ;)
Regards,
Ashley
--
To unsubscribe from this list, just send
Hi Steve,
AFAIK you need to remove the [ ] around the condition in the IF statement.
Have a look at http://www.rebol.com/docs/words/wif.html
Met vriendelijke groet / with kind regards,
Arie van Wingerden
http://home.zonnet.nl/rebolution
ICQ 343101686
- Original Message -
From:
Regarding your statements:
INPUT-FILE: make string! INPUT-FILE
etc., are you trying to convert the words INPUT-FILE and OUTPUT-FILE to
strings for examination, and then to file names for reading? If so, I
believe that the make function is not the one for the job, and might
be clobbering the
this works for me:
INPUT-FILE: ask enter filename:
ext: either ((length? INPUT-FILE) 3) [
copy at INPUT-FILE((length? INPUT-FILE) - 3)
][
]
print ext
if ext .txt [INPUT-FILE: append INPUT-FILE .txt]
print INPUT-FILE
Howdy,
On Sat, 15 Nov 2003, Steve Vondrasek wrote:
Greetings,
It seems like I always have the hardest time trying to do the simplest things.
For instance in the code snipet below the not equal comparison EXTENSION-IN
.txt always evaluates to true and always appends .txt to the
Hi Steve,
Arie nailed your problem, so I'll just add a couple notes if I may.
SV INPUT-FILE: ask Enter name of file with numbers to be processed: comment {
user enters owwnumbers.txt }
SV OUTPUT-FILE: ask Enter name of output file:
SV INPUT-FILE: make string! INPUT-FILE
SV OUTPUT-FILE:
Steve wrote:
if [EXTENSION-IN .txt] [append INPUT-FILE .txt ]
One thing that can help in the conversion to Rebol and to aid one's
understanding, is to swap the first square brackets with parenthesis, like:
if (EXTENSION-IN .txt) [append INPUT-FILE .txt ]
Andrew J Martin
Speaking in tongues
Now, the next step would be to generalize this stuff in case you need
it again in the future:
change-suffix: func [
{Changes the suffix of the string and returns the updated string.}
string [any-string!] The file, url, string, etc. to change.
suffix