Iβm not a string/char expert so I canβt tell you much about the actual sizes of these objects, Iβm afraid. However, you might want to take a look at Base.summarysize:
A Char value represents a single character: it is just a 32-bit primitive type with a special literal representation and appropriate arithmetic behaviors, and which can be converted to a numeric value representing a Unicode code point.
and
Whether these Unicode characters are displayed as escapes or shown as special characters depends on your terminalβs locale settings and its support for Unicode. String literals are encoded using the UTF-8 encoding. UTF-8 is a variable-width encoding, meaning that not all characters are encoded in the same number of bytes (βcode unitsβ). In UTF-8, ASCII characters β i.e. those with code points less than 0x80 (128) β are encoded as they are in ASCII, using a single byte, while code points 0x80 and above are encoded using multiple bytes β up to four per character.
Yes. Please just read it, and feel free to ask here if something is unclear.
Also note that sizeof("a") does not tell how how much memory the computer uses (since it does not contain the information for length, just the contents).
You are possibly looking for Base.summarysize("a"), which is 8 bytes for the length (Int) plus the byte 0x61 for the character βaβ (Strings are stored in UTF-8, which is variable-width).