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

Format String Literal Syntax #28

Open
pcperini opened this issue Jul 10, 2012 · 3 comments
Open

Format String Literal Syntax #28

pcperini opened this issue Jul 10, 2012 · 3 comments

Comments

@pcperini
Copy link

Feature request to circumvent (String stringWithFormat: 'Hello %@%s', 'World', "!"):

Declaring strings from formats should be as easy as:

formattedString := 'Hello %@%s': 'World', "!" // format, ... 
// or
formattedString := ('Hello %@%s': 'World', "!") // (format, ...)
@fabiopelosin
Copy link

What about string interpolation?

formattedString := 'Hello #{'World'}!'

@orta
Copy link

orta commented Aug 8, 2012

string interpolation is better than a format string IMO

@pcperini
Copy link
Author

pcperini commented Aug 8, 2012

might be a bit weird syntactically though. i like how python does it, so maybe something like:

world := 'World'
formattedString := 'Hello %world' // automatic interpolation from variables
// or
formattedString := 'Hello %world': {'world': world} // explicit interpolation from key/val pairs

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

No branches or pull requests

3 participants