|
||||||
|
||||||
String Interpolation
String interpolation allows you to insert the value of almost any valid boo expression inside a string by quoting the expression with $(). The parentheses are unnecessary if the expression is just a variable: String interpolation kicks in for both double and triple quoted strings: You can scape the $ character to prevent interpolation: You don't need to scape the $ char when it is followed by a space: Interpolation doesn't kick in inside single quoted strings: String FormattingBoo also has the "%" (modulus) operator as shorthand for .NET/Mono's string.Format method. This is a little more similar to Python's string interpolation, too. Combine boo and .net's string formattingThis tip suggested by Arron Washington. You can combine the two above techniques to get the best of both, like in this example: Another way is to pass formatting codes to the ToString method: See AlsoHere are some related resources on .NET string formatting: |
||||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
||||||