12.5 Data Types are Objects
All of the above data types are actually objects, each of which provides a range of functions and properties that may be used to perform a variety of different type specific tasks. These functions and properties are accessed using so-called dot notation. Dot notation involves accessing a function or property of an object by specifying the variable name followed by a dot followed in turn by the name of the property to be accessed or function to be called.
A string variable, for example, can be converted to uppercase via a call to the toUpperCase() function of the String class:
val myString = "The quick brown fox"
val uppercase = myString.toUpperCase()
Similarly, the length of a string is available by accessing the length property:
val length = myString.length
Functions are also available within the String class to perform tasks such as comparisons and checking for the presence of a specific word. The following code, for example...