Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

APPENDIX: The Visage Language in Depth > String Formatting and Internationaliza...

String Formatting and Internationalization

This section examines two more features of strings: the fine-grained formatting of numerical, date/time, and other types of values using format specifiers and the internationalization and localization of Visage applications.

Using String Format Specifications

Visage supports another, more versatile, form of string expression in which each brace-delimited segment may contain a string format specification and a Visage expression. Listing A-67 shows some examples of this form of string expression.

Listing A-67. Format Specifiers in String Expressions

var b = true;
var i = 1024;
var n = 3.14;
var str = "Hello, World";

println("Display b in a 15 character field   [{%15b b}].");
println("Display i in a 15 character field   [{%15d i}].");
println("Display n in a 15 character field   [{%15f n}].");
println("Display str in a 15 character field [{%15s str}].");

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial