Converting with

Notice also that you can convert a numeric value to a character using a type cast to AnsiChar or WideChar, but also relying on the classic Pascal technique, the use of the Chr compiler magic function (which can be considered as the opposite of Ord). This standard magic function has been expanded to take a word as parameter, rather than a byte.

Notice, though, that unlike character literals (covered in the section "String and Character Literals" later in this chapter), calls to Chr are now always interpreted in the Unicode realm. So if you port code like: | Chr (128)

from Delphi 2007 to Delphi 2009 you might be in for a surprise. If you use #128, instead, you might get a different result or not depending on your code page.

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment