Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to write ustring literally using a FormattableString #31

Open
ebekker opened this issue Jan 26, 2018 · 2 comments
Open

A way to write ustring literally using a FormattableString #31

ebekker opened this issue Jan 26, 2018 · 2 comments

Comments

@ebekker
Copy link

ebekker commented Jan 26, 2018

Wonder if there is any interest in being able to write a literal ustring that may contain embedded non-UTF16 friendly bytes? I was thinking that if you provide a parser for a FormattableString, you can use some Format Item format code to intermix literal character strings with raw bytes.

Something like:

var us = ustring.Make($"Sample {0xff::} Embedded");

This would yield a ustring (us) with the content:

Char Byte
'S' 83
'a' 97
'm' 109
'p' 112
'l' 108
'e' 101
' ' 32
ff 255
' ' 32
'E' 69
'm' 109
'b' 98
'e' 101
'd' 100
'd' 100
'e' 101
'd' 100
@ebekker
Copy link
Author

ebekker commented Jan 26, 2018

Is that what #23 is referring to?

@migueldeicaza
Copy link
Collaborator

The compiler already handles unicode characters with \u{...} syntax, the question is whether we need something different than this.

#23 is about creating a ustringBuilder similar to StringBuilder, so you can do:

var a = new ustringBuilder ();
a.Append ("Hello");
a.Append (',');
a.Append (" World");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants