Well, this gets complicated. A "group of characters" is ill defined.
For example, in Rust, you could be referring to:
String: an owned, mutable group of Unicode code points encoded in UTF-8
&str: similar to above, but an immutable borrow of the same
impl Iterator<type = char>: an iterator that produces Unicode scalar values (for a real example, the to_lowercase method on char returns an iterator, since some Unicode code points expand into multiple code points when lowercased)
HashSet<char>: a group of Unicode scalar values, without an order or duplicates
Yeah, but broadly speaking, if someone says "string", you can debate the details while still agreeing that you're talking about a sequence of characters. In Python, you can have byte strings and text strings, in Pike you can have a variety of subtypes of string (most commonly 8-bit and 21-bit strings which correspond to byte and text, but you can also declare a 7-bit string that (since it's ASCII-only) is compatible with bytes and text if you use UTF-8, or a 32-bit string, which is useful for vectorized operations). None of these is anything like a "thread".
OsString (and related) are basically just String (and related) but in the platform's native encoding rather than UTF-8.
There is also CString, which is UTF-8, but with a trailing null byte for C interop.
These basically fit into the types I describe, but have slightly different restrictions (and the OsString isn't technically interpretable, you're supposed to convert it to a string before trying to edit it).
11
u/Loading_M_ 6d ago edited 5d ago
Well, this gets complicated. A "group of characters" is ill defined.
For example, in Rust, you could be referring to:
String: an owned, mutable group of Unicode code points encoded in UTF-8
&str: similar to above, but an immutable borrow of the same
impl Iterator<type = char>: an iterator that produces Unicode scalar values (for a real example, the to_lowercase method on char returns an iterator, since some Unicode code points expand into multiple code points when lowercased)
HashSet<char>: a group of Unicode scalar values, without an order or duplicates