Skip to content

Commit

Permalink
alternate solution
Browse files Browse the repository at this point in the history
  • Loading branch information
eyvmal committed Aug 12, 2024
1 parent c09c9cc commit 2c244f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions csharp-fundamentals-strings.Main/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public StringBuilder two()
// 2. After adding the message, use an appropriate StringBuilder method to reverse it
// WRITE YOUR CODE BETWEEN THIS LINE...
sb.Append("Hello, world!");
sb.Replace("Hello, world!", "!dlrow ,olleH");
//sb.Replace("Hello, world!", "!dlrow ,olleH");
sb = new StringBuilder(new string(sb.ToString().Reverse().ToArray()));
// ...AND THIS LINE

return sb;
Expand All @@ -70,7 +71,8 @@ public StringBuilder three()
// 2. After adding the message, remove the comma.
// WRITE YOUR CODE BETWEEN THIS LINE...
sb.Append("Hello, world!");
sb.Replace(", ", " ");
// sb.Replace(", ", " ");
sb.Remove(5, 1);
// ...AND THIS LINE

return sb;
Expand Down

0 comments on commit 2c244f4

Please sign in to comment.