Skip to main content
added 9 characters in body
Source Link
ruohola
  • 664
  • 7
  • 15

When using string formatting for example with print!(), one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main() { print!( "{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.",   "I'm",  " Slim",  " Shady",  " the real",  " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

When using string formatting for example with print!(), one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.",   "I'm",  " Slim",  " Shady",  " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

When using string formatting for example with print!(), one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main() { print!( "{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real",  ); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

edited body
Source Link
ruohola
  • 664
  • 7
  • 15

When using string formatting for example with printlnprint!(), one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

When using string formatting for example with println!, one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

When using string formatting for example with print!(), one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

added 10 characters in body
Source Link
ruohola
  • 664
  • 7
  • 15

When using string formatting for example with println!, one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index once per itemon them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

When using string formatting for example with println!, one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index once per item. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

When using string formatting for example with println!, one can use both numbered and unnumbered formatters to save one byte per item to format:

Best shown with an example:

fn main(){ print!("{}{}{}. Yes, {0}{}{2}. All you other{1}{2}s are just imitating.", "I'm", " Slim", " Shady", " the real"); } 

Which outputs:

I'm Slim Shady. Yes, I'm the real Shady. All you other Slim Shadys are just imitating. 

So the unnumbered formatters will get assigned to the items in order, this allows you to skip the index on them. Note that you can only use one unnumbered formatter per item to format, after that it will get used up.

added 10 characters in body
Source Link
ruohola
  • 664
  • 7
  • 15
Loading
added 10 characters in body
Source Link
ruohola
  • 664
  • 7
  • 15
Loading
Source Link
ruohola
  • 664
  • 7
  • 15
Loading