Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Name Normalizer | Text Formatting & Manual Parsing
C# Strings & Text Processing

bookChallenge: Name Normalizer

Aufgabe

Swipe to start coding

Write a function that takes a string containing a person's name with inconsistent spacing and casing, and returns the name in a standardized format. The standardized format should have each word capitalized (first letter uppercase, remaining letters lowercase), with single spaces between words and no leading or trailing spaces.

  • Remove any leading and trailing spaces from the input string.
  • Convert the entire string to lowercase.
  • Split the string into words, removing any extra spaces between words.
  • Capitalize the first letter of each word and leave the remaining letters in lowercase.
  • Join the words back together with a single space between each word.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 7
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

bookChallenge: Name Normalizer

Swipe um das Menü anzuzeigen

Aufgabe

Swipe to start coding

Write a function that takes a string containing a person's name with inconsistent spacing and casing, and returns the name in a standardized format. The standardized format should have each word capitalized (first letter uppercase, remaining letters lowercase), with single spaces between words and no leading or trailing spaces.

  • Remove any leading and trailing spaces from the input string.
  • Convert the entire string to lowercase.
  • Split the string into words, removing any extra spaces between words.
  • Capitalize the first letter of each word and leave the remaining letters in lowercase.
  • Join the words back together with a single space between each word.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 7
single

single

some-alt