char_indices() -> chars()

Co-Authored-By: Noah <33094578+coolreader18@users.noreply.github.com>
This commit is contained in:
Jeong YunWonandNoah authored and GitHub committed 2020-03-08 06:42:53 +09:00
1 parent 6ca457932b
commit 6bfd349ef6
1 file changed
+3 -3
+3 -3
View File
@@ -407,12 +407,12 @@ impl PyString {
#[pymethod]
fn capitalize(&self) -> String {
let mut char_indices = self.value.char_indices();
if let Some((_, first_char)) = char_indices.next() {
let mut chars = self.value.chars();
if let Some(first_char) = chars.next() {
format!(
"{}{}",
first_char.to_uppercase(),
&self.value[first_char.len_utf8()..].to_lowercase(),
&chars.as_str().to_lowercase(),
)
} else {
"".to_owned()