Note that this method compares the strings byte per byte and is only meant for use with non-localized sorting. The results of the sort will always be the same, but may not appear logical to human beings.
In Emojicode strings are strictly used to represent textual data, i.e. strings are not used to store binary data or the like. If you need to work with binary data see 📇.
Characters, Graphemes and Random Access
Due to the complexity of working with text, 🔡 does not support random access. For instance, consider this character
한. To a human being, this is one character. Yet, it actually consists of three Unicode code points, as this is the characters ㅎ, ㅏ and ㄴ combined. An even better example is
✋🏾 (you should see a raised hand with darker skin color). While this is one emoji, it is composed by two Unicode code points and encoded with seven bytes in UTF-8.
Unicode defines ✋🏾 and 한 as graphemes. A grapheme is what humans would recognize as one character.
Emojicode only allows you to access these graphemes. Finding graphemes is not a constant-time operation, though. Random access is not possible, therefore.
If you need to deal with the graphemes of a string, you can use the 🎶❗️ method, which returns an array of graphemes. Graphemes are always represented as strings.
To determine the number of graphemes in a string, you can use 🐔 on that array. To determine the number of UTF-8 bytes that make up a string, use 📐.
If you want to determine whether two strings represent the same value, you can use the equality operator 🙌.
🍪🔤Straw🔤 🔤berries🔤🍪 🙌 🔤Strawberries🔤
You can learn more about the equality operator in Operators.
Strings are immutable. This means that you can’t modify any string. You can, however, call methods on strings that return modified copies of the orginal string, but those themselves are then immutable again.
String Literals and Concatenate Literals
To learn more about 🔤🔤 String Literals and 🍪🍪 Concatenate Literals see the Language Reference.
Waits for the user to input a text and confirm it with enter. No new line character is included as part of the string. (Via the standard input/output)
Creates a string by joining all elements into a string separated by separator.
❗️ 🧠 ➡️ 🧠
Returns the memory area representing the value of this string.
Puts this 🔡 to the standard output.
Puts this 🔡 to the standard output without adding a new line.
Compares this string to b and returns -1, 0, or 1 depending on whether this string is less than, equal to, or greater than
Returns a new string consisting of length graphemes beginning from the grapheme at index from in this string. Complexity: O(n).
🔪🔤🇦🇽👨👩👧👧🤚🏾🔤 1 1❗️ 💭 returns 🔤👨👩👧👧🔤 🔪🔤Apples🔤 2 4❗️ 💭 returns 🔤ples🔤
Finds the first occurrences of search in this string. Search is performed from left to right.
Returns the index of the first occurrence or no value if search does not occur.
Finds the first occurrences of a string in this string after the index offset. Search is performed from left to right.
Returns the index of the occurrence or no value if search does not occur.
This string is split up into substring at each place seperator is found. seperator itself is removed from the string.
❗️ 🔧 ➡️ 🔡
The 🔧 method returns a new string, on which whitespace has been removed from both ends of a string.
❗️ 📐 ➡️ 🔢
Returns the number of bytes required to represent the string’s content in UTF8.
📐🔤✋🏾🔤❗️ 💭 returns 7 📐🔤한🔤❗️ 💭 returns 3 📐🔤A🔤❗️ 💭 returns 1
The return value is not at all meaningful from a human perspective. The character
ä for instance, is encoded with two bytes but clearly perceived as one character.
This methods tries to construct an integer from this string in the given base. It returns the integer or no value if the string does not match the regular expression
[+-]?[0-9a-zA-Z]+ or it does not represent a valid value in the given base.
❗️ 💯 ➡️ 🍬💯
This methods tries to construct a 💯 from this 🔡. It returns the 💯, or no value if the 🔡 does not match the regular expression
[+-]?([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)([eE][+-]?[0-9]+)? or if it does not represent a valid 💯.
❗️ 📇 ➡️ 📇
Converts the string to data encoded as UTF8.
❗️ ⚗ ➡️ 🔢
Hashes this string. The results for strings whose values equal are guaranteed to be the same within a process.
❗️ 📫 ➡️ 🔡
Returns a new string in which all characters have been converted to their respective uppercase equivalents.
❗️ 📪 ➡️ 🔡
Returns a new string in which all characters have been converted to their respective lowercase equivalents.