Split the string into a vector of other strings delimited by the attribute provided. ``` use teensycore::*; use teensycore::system::str::*; let string = str!(b"hello\nworld"); let strings = string.split(b'\n'); ```
(&self, target: u8)
| 420 | /// let strings = string.split(b'\n'); |
| 421 | /// ``` |
| 422 | fn split(&self, target: u8) -> Vector<Str> { |
| 423 | let mut result = Vector::new(); |
| 424 | let mut temp = Str::new(); |
| 425 | |
| 426 | for char in self.into_iter() { |
| 427 | if char == target { |
| 428 | result.push(Str::from_str(&temp)); |
| 429 | temp.clear(); |
| 430 | } else { |
| 431 | temp.append(&[char]); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | if temp.len() > 0 { |
| 436 | result.push(Str::from_str(&temp)); |
| 437 | } |
| 438 | |
| 439 | temp.clear(); |
| 440 | temp.drop(); |
| 441 | |
| 442 | return result; |
| 443 | } |
| 444 | |
| 445 | /// Searches Self for a matching content string. Returns |
| 446 | /// true if a match is found. |