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

[REBOL] Re: [subject: escape characters]

From: joel:neely:fedex at: 24-Feb-2002 7:31

Hi, Pat, pat665 wrote:
> ... What I would like now is to populate a third column > with a more symbolic notation. For now, I have got only > three item for this column. >
According to in the section on "Strings": You can include special characters and operations in strings by prefixing them with a caret (^). Special characters include: Special Characters Character Definition " Inserts a double quote ("). } Inserts a closing brace (}). ^ Inserts a caret (^). / Starts a new line. (line) Starts a new line. - Inserts a tab. (tab) Inserts a tab. (page) Starts a new page. (letter) Inserts control-letter (A-Z). (back) Erases one character left of the insertion point. (null) Inserts a null character. (escape) Inserts an escape character. (xx) Inserts an ASCII character by hex (xx) number. and in the section on "Other Values / Character": Characters can include escape sequences that begin with a caret (^) and are followed by one or more characters of encoding. This encoding can include the characters #"^A" to #"^Z" for control A to control Z (upper- and lower-case are the same): #"^A" #"^Z" Following is a table of control characters that can be used in REBOL. Control Characters Character Definition #"(null)" or #"@" null (zero) #"(line)", #"/" or, #"." end of line #"(tab)" or #"-" horizontal tab #"(page)" new page (and page eject) #"(esc)" escape #"(back)" backspace #"(del)" delete #"^" caret character #"^"" quotation mark #"(00)" to #"(FF)" hex forms of characters The entries all (except #"^"") contain the typo that the ^ prefix is omitted. Also, notice that ^(esc) works for both character and string literals, while ^(escape) works only in strings. -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;