MCPcopy Create free account
hub / github.com/davidblewett/rure-python / splitn

Method splitn

regex/src/re_bytes.rs:343–352  ·  view source on GitHub ↗

Returns an iterator of at most `limit` substrings of `text` delimited by a match of the regular expression. (A `limit` of `0` will return no substrings.) Namely, each element of the iterator corresponds to text that *isn't* matched by the regular expression. The remainder of the string that is not split will be the last element in the iterator. This method will *not* copy the text given. # Examp

(
        &'r self,
        text: &'t [u8],
        limit: usize,
    )

Source from the content-addressed store, hash-verified

341 /// # }
342 /// ```
343 pub fn splitn<'r, 't>(
344 &'r self,
345 text: &'t [u8],
346 limit: usize,
347 ) -> SplitN<'r, 't> {
348 SplitN {
349 splits: self.split(text),
350 n: limit,
351 }
352 }
353
354 /// Replaces the leftmost-first match with the replacement provided. The
355 /// replacement can be a regular byte string (where `$N` and `$name` are

Callers

nothing calls this directly

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected