String and Character Literals

We have seen in several examples that you can assign an individual character literal or a string literal to any of the string types, with the proper conversion taking place behind the scenes.

String literals are invariable considered of the UnicodeString type. Notice that this could cause issues with overloading resolution when passing a constant string to a function like Pos, that now has multiple versions. In general, though, the management of string literals is quite direct. As we saw in the last chapter, you can add any Unicode character to a constant string in the editor, and everything will work smoothly.

Character literals cause some more issues though, particularly for backward compatibility reasons. Plain character literals are converted depending on their context. It is more difficult for the compiler to determine what to do with hexadecimal (or decimal) character literals, like in the following code taken from the HighCharTest example:

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