Useful API Functions: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Inhalt gelöscht Inhalt hinzugefügt
Cg (Diskussion | Beiträge) |
Cg (Diskussion | Beiträge) |
||
| Zeile 9: | Zeile 9: | ||
==== Comparing ==== |
==== Comparing ==== |
||
''string1'' = ''string2'' |
''string1'' = ''string2''<br> compares case sensitive |
||
:compares case sensitive |
|||
''string1'' sameAs: ''string2'' |
''string1'' sameAs: ''string2'' |
||
:compares case insensitive |
:compares case insensitive |
||
Version vom 25. September 2020, 17:28 Uhr
This document lists most useful (and most often needed) functions. Be aware, that there are many more to be found in either the class references or via the builtin class browser.
All of the following are functional operators; meaning that they do not modify the argument(s).
Comparing
string1 = string2
compares case sensitive
string1 sameAs: string2
- compares case insensitive
Case Conversion
aString asLowercase
aString asUppercase
aString asUppercaseFirst
- return a case converted string
Finding Characters or Substrings
aString indexOf: aCharacter
- return the 1-based index, or 0 if not found. Notice that character constants are denoted as $x in Smalltalk (pr "Character return", "Character newline", "Character tab"...)
aString lastIndexOf: aCharacter
- searching from the end, return the 1-based index, or 0 if not found.
aString includes: aCharacter
- return true if the character is included, false if not
Reference: String inherits from: CharacterArray and SequenceableCollection and Collection
Reference: Collection
Reference: Filename
Reference: Stream
Reference: Number and its subclasses Integer, Float, Fraction, Complex