Some String messages of interest
Last updated at 2:13 am UTC on 2 July 2018
Strings are one of the most used classes in any Smalltalk system. Here we have a look at one or two of the more useful messages specific to Strings.
One way in which strings differ is that their contents, Characters, often differ only in case. For this reason there are several messages which take this into account. For example when comparing two string we can of course use #=, but this will perform a case sensitive comparison. If we need to compare two string in a case-insensitive manner we can instead use #sameAs:
A good example would be
'Hello' = 'hello'. => false
'Hello' sameAs: 'hello'. => true