Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Extract Initials | Fundamentals of Strings
C# Strings and Text Processing

bookChallenge: Extract Initials

Uppgift

Swipe to start coding

You are given a full name as a single string. The name may contain one or more spaces, and you must:

  1. Extract the first name (everything before the first space).
  2. Extract the last name (everything after the last space).
  3. Generate the initials in the format F.L..

If the input does not contain any spaces, treat the entire string as a first name and display:

  • First name
  • "Last name not found"
  • Initials using only the first letter (e.g. J.)

You may use ToUpper() to format the initials, but it is not required. The task is considered correct regardless of letter casing.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 4
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Extract Initials

Svep för att visa menyn

Uppgift

Swipe to start coding

You are given a full name as a single string. The name may contain one or more spaces, and you must:

  1. Extract the first name (everything before the first space).
  2. Extract the last name (everything after the last space).
  3. Generate the initials in the format F.L..

If the input does not contain any spaces, treat the entire string as a first name and display:

  • First name
  • "Last name not found"
  • Initials using only the first letter (e.g. J.)

You may use ToUpper() to format the initials, but it is not required. The task is considered correct regardless of letter casing.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 4
single

single

some-alt