Created
June 14, 2019 22:13
-
-
Save joseoliv/cbabb596ea920eaf951f643cbc5717aa to your computer and use it in GitHub Desktop.
string_n_N
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
This is a literal string annotation, an identifier precedes a literal | |
string. In the string, escape characters are not considered. | |
The algorithm used for not-escaping the characters is not perfect. | |
It only considers letters such as \n and \r. An alternative to | |
this metaobject is to use triple quotes: | |
assert """\n""" == n"\n"; | |
*} | |
object String_n_N | |
func run { | |
var s = n"\r\n"; | |
assert s size == 4; | |
assert s == """\r\n"""; | |
assert """\n""" == n"\n"; | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment