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: richard:coffre:francetelecom at: 11-Apr-2002 8:55

Thanks Gregg for this detail, I thought about this but because I'm new in Rebol I walk through step by step but your explanation will allow me to speed up. -----Message d'origine----- De : Gregg Irwin [mailto:[greggirwin--mindspring--com]] Envoy=E9 : mercredi 10 avril 2002 18:53 =C0 : [rebol-list--rebol--com] Objet : [REBOL] Re: Script Error: Cannot use add on string! value 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