08-10-2011, 04:16 AM,
(This post was last modified: 08-10-2011, 04:27 AM by RobertShiplett.)
|
|||||
|
|||||
Curl macros introduction (part 4)
A Curl macro that accepts expressions: {ndashe }
As you might guess, {ndashe } links Strings from two expressions with a so-called n-dash or Unicode UTF-8 code point 2013 which is the Curl char represented as '\u2013'. The changes are as follows: Code: {define-macro public {ndashe ?e1:expression , ?e2:expression} and if we now test with Code: {let public str1:String = "this", str2:String = "these"} what we will see is On the web page Curl Wrote:We ndashe'd THIS–THESE One subtle change was required: the "hyphen" could not be used in the macro because it cannot separate two expressions as it is itself used as an infix operator for a {subtract } expression. Even if it seemed cute to use the hyphen, most often the comma will be your best choice. But why would we want {ndashi } or {ndashe }? Wouldn't we want an {endash } macro to accept such curl source or text as we pass in? For that we will need patterns and the Curl {syntax-switch } macro.
Robert Shiplett, Curlr
Fredericton NB Canada |
|||||
« Next Oldest | Next Newest »
|
Users browsing this thread:
1 Guest(s)
1 Guest(s)