MCPcopy Index your code
hub / github.com/RustPython/RustPython / capitalize

Method capitalize

crates/vm/src/bytes_inner.rs:406–413  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

404 }
405
406 pub fn capitalize(&self) -> Vec<u8> {
407 let mut new: Vec<u8> = Vec::with_capacity(self.elements.len());
408 if let Some((first, second)) = self.elements.split_first() {
409 new.push(first.to_ascii_uppercase());
410 second.iter().for_each(|x| new.push(x.to_ascii_lowercase()));
411 }
412 new
413 }
414
415 pub fn swapcase(&self) -> Vec<u8> {
416 let mut new: Vec<u8> = Vec::with_capacity(self.elements.len());

Callers 3

builtin_str.pyFile · 0.45
builtin_bytes.pyFile · 0.45

Calls 5

to_ascii_uppercaseMethod · 0.80
to_ascii_lowercaseMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected