Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Script Error: Cannot use add on string! value

From: greggirwin:mindspring at: 10-Apr-2002 10:53

Hi Richard, << file: to-file ask "Filename? " parse file [ copy output to "." ] output: output + ".sty" >> The + operator in REBOL is not a string concatenation operator. If you do help + in the console you'll see all the datatypes it supports. Use JOIN or APPEND instead of + to concatenate strings. You want to be careful searching for the first dot, as you are, because long filenames can contain embedded dots and the last one is what you want. Here's another approach, changing the value in place and using FIND/LAST.
>> file: "dummy.txt"
== "dummy.txt"
>> head change find/last file "." ".sty"
== "dummy.sty"
>> file: "dummy.2.txt"
== "dummy.2.txt"
>> head change find/last file "." ".sty"
== "dummy.2.sty" --Gregg