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

13. User Interaction > Write Culture-Aware Scripts

Write Culture-Aware Scripts

Problem

You want to ensure that your script works well on computers around the world.

Solution

To write culture-aware scripts, keep the following guidelines in mind as you develop your scripts:

  • Create dates, times, and numbers using PowerShell’s language primitives.

  • Compare strings using PowerShell’s built-in operators.

  • Avoid treating user input as a collection of characters.

  • Use Parse() methods to convert user input to dates, times, and numbers.

Discussion

Writing culture-aware programs has long been isolated to the world of professional software developers. It’s not that users of simple programs and scripts can’t benefit from culture awareness, though. It has just frequently been too difficult for nonprofessional programmers to follow the best practices. However, PowerShell makes this much easier than traditional programming languages.


  

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


 Â