MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / naive_capitalize

Function naive_capitalize

04_strings_unicode/rust/uppercase.rs:3–9  ·  view source on GitHub ↗

example showing uppercasing for unicode and ASCII

(s: &str)

Source from the content-addressed store, hash-verified

1//! example showing uppercasing for unicode and ASCII
2//!
3fn naive_capitalize(s: &str) -> String {
4 let mut c = s.chars();
5 match c.next() {
6 None => String::new(),
7 Some(f) => f.to_uppercase().to_string() + c.as_str(),
8 }
9}
10
11fn ascii_capitalize(s: &str) -> String {
12 let mut c = s.chars();

Callers

nothing calls this directly

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected