Convert str::concat to ivecs
This commit is contained in:
parent
1e397eee2a
commit
09cc957030
@ -449,7 +449,7 @@ fn split(s: str, sep: u8) -> [str] {
|
||||
ret v;
|
||||
}
|
||||
|
||||
fn concat(v: vec[str]) -> str {
|
||||
fn concat(v: &[str]) -> str {
|
||||
let s: str = "";
|
||||
for ss: str in v { s += ss; }
|
||||
ret s;
|
||||
|
@ -69,11 +69,11 @@ fn test_substr() {
|
||||
|
||||
#[test]
|
||||
fn test_concat() {
|
||||
fn t(v: &vec[str], s: &str) { assert (str::eq(str::concat(v), s)); }
|
||||
t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
|
||||
let v: vec[str] = [];
|
||||
fn t(v: &[str], s: &str) { assert (str::eq(str::concat(v), s)); }
|
||||
t(~["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
|
||||
let v: [str] = ~[];
|
||||
t(v, "");
|
||||
t(["hi"], "hi");
|
||||
t(~["hi"], "hi");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user