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

Method swapcase

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

Source from the content-addressed store, hash-verified

413 }
414
415 pub fn swapcase(&self) -> Vec<u8> {
416 let mut new: Vec<u8> = Vec::with_capacity(self.elements.len());
417 for w in &self.elements {
418 match w {
419 b'A'..=b'Z' => new.push(w.to_ascii_lowercase()),
420 b'a'..=b'z' => new.push(w.to_ascii_uppercase()),
421 x => new.push(*x),
422 }
423 }
424 new
425 }
426
427 pub fn hex(
428 &self,

Callers 2

builtin_bytes.pyFile · 0.45

Calls 4

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

Tested by

no test coverage detected