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

Method title

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

Source from the content-addressed store, hash-verified

921 }
922
923 pub fn title(&self) -> Vec<u8> {
924 let mut res = vec![];
925 let mut spaced = true;
926
927 for i in &self.elements {
928 match i {
929 b'A'..=b'Z' | b'a'..=b'z' => {
930 if spaced {
931 res.push(i.to_ascii_uppercase());
932 spaced = false
933 } else {
934 res.push(i.to_ascii_lowercase());
935 }
936 }
937 _ => {
938 res.push(*i);
939 spaced = true
940 }
941 }
942 }
943
944 res
945 }
946
947 pub fn cformat(&self, values: PyObjectRef, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
948 cformat_bytes(vm, self.elements.as_slice(), values)

Callers 3

builtin_str.pyFile · 0.45
builtin_bytes.pyFile · 0.45

Calls 3

to_ascii_uppercaseMethod · 0.80
to_ascii_lowercaseMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected