Removing a character from a string

Started by Jma on 21-May-2014/6:25:05-7:00
@Nick: I want to remove the character 's' from "https" in a url string: "https://...." Can you help me, please? Thanks in advance!
Hi Jma, What have you tried already? If you use Rebol3 then some help can be found http://www.rebol.com/r3/docs/functions/replace.html replace https-url "https://" "http://" If you use Rebol2 then replace doc is http://www.rebol.com/docs/words/wreplace.html >> help url Found these words: decode-url function! Decode a URL into an object. to-url function! [value] url! datatype! url! url? action! Returns TRUE for url values. >> https-url: to-url "https://www.rebol.com" == https://www.rebol.com >> http-url: replace https-url "https://" "http://" == http://www.rebol.com >> type? http-url == url! >> Does this answer your question? Regards, Arnold
I want to remove a single character from a string. If I have the string "rebol", how do I remove the character "o" so that the string becomes "rebl" ?
>> head remove find "rebol" "o" == "rebl"
Take a read of this - http://www.rebol.com/docs/core23/rebolcore-6.html It should help you understand my answer,
This also works: x: "rebol" replace x "o" ""
Quick note on this one - x: "rebol" replace x "o" "" It will only replace the first "o". replace/all can be used to change them all. eg x: "rebolo" replace x "o" "" => "rebl"
x: "rebolo" replace/ALL x "o" "" => "rebl"

Reply