Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created June 14, 2019 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/cbabb596ea920eaf951f643cbc5717aa to your computer and use it in GitHub Desktop.
Save joseoliv/cbabb596ea920eaf951f643cbc5717aa to your computer and use it in GitHub Desktop.
string_n_N
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