Category talk:Wren-str: Difference between revisions
Content added Content deleted
(→Source code: Added Utf8.fromWin1252 method.) |
(Fixed minor bug in Greek.names property and added Str.splitNoEmpty method.) |
||
Line 415: | Line 415: | ||
if (final > 0) res.add(sub(s, first..-1)) |
if (final > 0) res.add(sub(s, first..-1)) |
||
return res |
return res |
||
} |
|||
// Splits 's' into a list of one or more strings separated by 'sep' but removes |
|||
// any empty elements from the list. |
|||
static splitNoEmpty(s, sep) { |
|||
if (!(s is String)) s = "%(s)" |
|||
if (!(sep is String) || sep.isEmpty) Fiber.abort("Separator must be a non-empty string.") |
|||
var split = s.split(sep) |
|||
return split.where { |e| !e.isEmpty }.toList |
|||
} |
} |
||
Line 597: | Line 606: | ||
return [ |
return [ |
||
"alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", |
"alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", |
||
" |
"iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", |
||
"rho", "sigma final", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega" |
"rho", "sigma final", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega" |
||
] |
] |