1
Fork 0

String split renaming:

* Renamed str::split -> str::split_byte
* Renamed str::splitn -> str::splitn_byte
* Renamed str::split_func -> str::split
* Renamed str::split_char -> str::split_char
* Renamed str::split_chars_iter -> str::split_char_iter
* Added u8::is_ascii
* Fixed the behavior of str::split_str, so that it matches split_chars
  and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", "."))
* Fixed str::split_byte and str::splitn_byte so that they handle
  splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle ""
  as the others do
This commit is contained in:
Kevin Cantu 2012-02-01 20:31:01 -08:00 committed by Brian Anderson
parent 159aebc28b
commit a3f5626ad1
10 changed files with 189 additions and 141 deletions

View file

@ -199,7 +199,7 @@ fn check_error_patterns(props: test_props,
let next_err_idx = 0u;
let next_err_pat = props.error_patterns[next_err_idx];
for line: str in str::split(procres.stdout, '\n' as u8) {
for line: str in str::split_byte(procres.stdout, '\n' as u8) {
if str::find(line, next_err_pat) > 0 {
#debug("found error pattern %s", next_err_pat);
next_err_idx += 1u;
@ -246,7 +246,7 @@ fn check_expected_errors(expected_errors: [errors::expected_error],
// filename:line1:col1: line2:col2: *warning:* msg
// where line1:col1: is the starting point, line2:col2:
// is the ending point, and * represents ANSI color codes.
for line: str in str::split(procres.stdout, '\n' as u8) {
for line: str in str::split_byte(procres.stdout, '\n' as u8) {
let was_expected = false;
vec::iteri(expected_errors) {|i, ee|
if !found_flags[i] {
@ -349,7 +349,7 @@ fn split_maybe_args(argstr: option<str>) -> [str] {
}
alt argstr {
option::some(s) { rm_whitespace(str::split(s, ' ' as u8)) }
option::some(s) { rm_whitespace(str::split_byte(s, ' ' as u8)) }
option::none { [] }
}
}
@ -411,7 +411,7 @@ fn output_base_name(config: config, testfile: str) -> str {
let base = config.build_base;
let filename =
{
let parts = str::split(fs::basename(testfile), '.' as u8);
let parts = str::split_byte(fs::basename(testfile), '.' as u8);
parts = vec::slice(parts, 0u, vec::len(parts) - 1u);
str::connect(parts, ".")
};