Summary#
Text.Split(s, separator) splits s on each occurrence of separator and returns the substrings as a
List<string> — the mutable-list shape, so the result is iterable with foreach and supports
.Count and .Contains. This is the inverse of string.Join, and mirrors C#'s
string.Split(separator) with StringSplitOptions.None: empty segments are kept.
Signature#
Text.Split(<string> s, <string> separator) -> List<string>Description#
The result is a real List<string> (not a read-only query result), so the collection surface applies:
foreach, .Count, .Contains, and passing it to string.Join. Membership and iteration are the
idiomatic ways to consume it.
Empty handling is C#-faithful (StringSplitOptions.None): Text.Split("a,,b", ",") yields three
elements ["a", "", "b"], and Text.Split("", ",") yields a single empty element [""].
Text.Split is in-memory only — a split produces a set, which has no SQL push-down form, so it is
called on locals inside a function body, never inside a query predicate.
Examples#
List<string> TrimFields(string csv) {
var trimmed = new List<string>();
foreach (var field in Text.Split(csv, ",")) {
trimmed.Add(Text.Trim(field));
}
return trimmed;
}
// TrimFields("orders, customers , items") -> ["orders", "customers", "items"]See also#
- String interpolation & format specifiers —
string.Joinis the inverse (list → string) - Text.LastIndexOf — the other in-memory-only string builtin