From 7a09e04c90910d6f1c6765a35fdfbc13c1ba6439 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:26:15 +0800 Subject: [PATCH 1/9] Create Program.cs --- Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Program.cs diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..c418fdf --- /dev/null +++ b/Program.cs @@ -0,0 +1,13 @@ +using StringProcessingApp.Views; + +namespace StringProcessingApp +{ + internal class Program + { + static void Main(string[] args) + { + StringView view = new StringView(); + view.Run(); + } + } +} From 29849b3c10abc80943e13cb78fae5ca779a39305 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:27:59 +0800 Subject: [PATCH 2/9] Create StringService.cs --- Services/StringService.cs | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Services/StringService.cs diff --git a/Services/StringService.cs b/Services/StringService.cs new file mode 100644 index 0000000..b382d00 --- /dev/null +++ b/Services/StringService.cs @@ -0,0 +1,61 @@ +using System; + +namespace StringProcessingApp.Services +{ + public class StringService + { + private string _originalText = ""; + private string _currentText = ""; + + public void SetText(string text) + { + _originalText = text; + _currentText = text; + } + + public string GetText() + { + return _currentText; + } + + public void ToUpperCase() + { + _currentText = _currentText.ToUpper(); + } + + public void ToLowerCase() + { + _currentText = _currentText.ToLower(); + } + + public int CountCharacters() + { + return _currentText.Length; + } + + public bool ContainsWord(string word) + { + return _currentText.Contains(word); + } + + public void ReplaceWord(string oldWord, string newWord) + { + _currentText = _currentText.Replace(oldWord, newWord); + } + + public string ExtractSubstring(int startIndex, int length) + { + return _currentText.Substring(startIndex, length); + } + + public void TrimSpaces() + { + _currentText = _currentText.Trim(); + } + + public void Reset() + { + _currentText = _originalText; + } + } +} From 28868f1370739706fb7323a1d7f879dc10baeb57 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:33:43 +0800 Subject: [PATCH 3/9] Create StringView.cs --- Views/StringView.cs | 143 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Views/StringView.cs diff --git a/Views/StringView.cs b/Views/StringView.cs new file mode 100644 index 0000000..7c215af --- /dev/null +++ b/Views/StringView.cs @@ -0,0 +1,143 @@ +using System; +using StringProcessingApp.Services; + +namespace StringProcessingApp.Views +{ + public class StringView + { + private readonly StringService _service; + + public StringView() + { + _service = new StringService(); + } + + public void Run() + { + bool running = true; + + while (running) + { + ShowMenu(); + Console.Write("Select an option: "); + string choice = Console.ReadLine(); + + Console.WriteLine(); + + switch (choice) + { + case "1": + EnterText(); + break; + case "2": + ViewCurrentText(); + break; + case "3": + _service.ToUpperCase(); + Console.WriteLine("Converted to UPPERCASE."); + break; + case "4": + _service.ToLowerCase(); + Console.WriteLine("Converted to lowercase."); + break; + case "5": + Console.WriteLine($"Character Count: {_service.CountCharacters()}"); + break; + case "6": + CheckContains(); + break; + case "7": + ReplaceWord(); + break; + case "8": + ExtractSubstring(); + break; + case "9": + _service.TrimSpaces(); + Console.WriteLine("Spaces trimmed."); + break; + case "10": + _service.Reset(); + Console.WriteLine("Text reset to original."); + break; + case "11": + running = false; + Console.WriteLine("Thank you for using the app, bye!"); + break; + default: + Console.WriteLine("Invalid choice. Please try again."); + break; + } + + Console.WriteLine(); + } + } + + private void ShowMenu() + { + Console.WriteLine("===== STRING PROCESSING SYSTEM ====="); + Console.WriteLine("1. Enter Text"); + Console.WriteLine("2. View Current Text"); + Console.WriteLine("3. Convert to UPPERCASE"); + Console.WriteLine("4. Convert to lowercase"); + Console.WriteLine("5. Count Characters"); + Console.WriteLine("6. Check if Contains Word"); + Console.WriteLine("7. Replace Word"); + Console.WriteLine("8. Extract Substring"); + Console.WriteLine("9. Trim Spaces"); + Console.WriteLine("10. Reset Text"); + Console.WriteLine("11. Exit"); + Console.WriteLine("===================================="); + } + + private void EnterText() + { + Console.Write("Enter your text: "); + string text = Console.ReadLine(); + _service.SetText(text); + Console.WriteLine("Text saved successfully."); + } + + private void ViewCurrentText() + { + Console.WriteLine($"Current Text: {_service.GetText()}"); + } + + private void CheckContains() + { + Console.Write("Enter word to check: "); + string word = Console.ReadLine(); + + bool result = _service.ContainsWord(word); + + if (result) + Console.WriteLine("The text contains the word."); + else + Console.WriteLine("The text does NOT contain the word."); + } + + private void ReplaceWord() + { + Console.Write("Enter word to replace: "); + string oldWord = Console.ReadLine(); + + Console.Write("Enter new word: "); + string newWord = Console.ReadLine(); + + _service.ReplaceWord(oldWord, newWord); + Console.WriteLine("Word replaced successfully."); + } + + private void ExtractSubstring() + { + Console.Write("Enter start index: "); + int start = int.Parse(Console.ReadLine()); + + Console.Write("Enter length: "); + int length = int.Parse(Console.ReadLine()); + + string result = _service.ExtractSubstring(start, length); + Console.WriteLine($"Extracted Substring: {result}"); + } + } +} From eea56a255a4a6ce8ac156aa5e843bb4f73e4175d Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:38:13 +0800 Subject: [PATCH 4/9] Delete Services/StringService.cs --- Services/StringService.cs | 61 --------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 Services/StringService.cs diff --git a/Services/StringService.cs b/Services/StringService.cs deleted file mode 100644 index b382d00..0000000 --- a/Services/StringService.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; - -namespace StringProcessingApp.Services -{ - public class StringService - { - private string _originalText = ""; - private string _currentText = ""; - - public void SetText(string text) - { - _originalText = text; - _currentText = text; - } - - public string GetText() - { - return _currentText; - } - - public void ToUpperCase() - { - _currentText = _currentText.ToUpper(); - } - - public void ToLowerCase() - { - _currentText = _currentText.ToLower(); - } - - public int CountCharacters() - { - return _currentText.Length; - } - - public bool ContainsWord(string word) - { - return _currentText.Contains(word); - } - - public void ReplaceWord(string oldWord, string newWord) - { - _currentText = _currentText.Replace(oldWord, newWord); - } - - public string ExtractSubstring(int startIndex, int length) - { - return _currentText.Substring(startIndex, length); - } - - public void TrimSpaces() - { - _currentText = _currentText.Trim(); - } - - public void Reset() - { - _currentText = _originalText; - } - } -} From 43a1a598d19809fa30122306ce15fb99cbb60e35 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:38:52 +0800 Subject: [PATCH 5/9] Delete Views/StringView.cs --- Views/StringView.cs | 143 -------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 Views/StringView.cs diff --git a/Views/StringView.cs b/Views/StringView.cs deleted file mode 100644 index 7c215af..0000000 --- a/Views/StringView.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using StringProcessingApp.Services; - -namespace StringProcessingApp.Views -{ - public class StringView - { - private readonly StringService _service; - - public StringView() - { - _service = new StringService(); - } - - public void Run() - { - bool running = true; - - while (running) - { - ShowMenu(); - Console.Write("Select an option: "); - string choice = Console.ReadLine(); - - Console.WriteLine(); - - switch (choice) - { - case "1": - EnterText(); - break; - case "2": - ViewCurrentText(); - break; - case "3": - _service.ToUpperCase(); - Console.WriteLine("Converted to UPPERCASE."); - break; - case "4": - _service.ToLowerCase(); - Console.WriteLine("Converted to lowercase."); - break; - case "5": - Console.WriteLine($"Character Count: {_service.CountCharacters()}"); - break; - case "6": - CheckContains(); - break; - case "7": - ReplaceWord(); - break; - case "8": - ExtractSubstring(); - break; - case "9": - _service.TrimSpaces(); - Console.WriteLine("Spaces trimmed."); - break; - case "10": - _service.Reset(); - Console.WriteLine("Text reset to original."); - break; - case "11": - running = false; - Console.WriteLine("Thank you for using the app, bye!"); - break; - default: - Console.WriteLine("Invalid choice. Please try again."); - break; - } - - Console.WriteLine(); - } - } - - private void ShowMenu() - { - Console.WriteLine("===== STRING PROCESSING SYSTEM ====="); - Console.WriteLine("1. Enter Text"); - Console.WriteLine("2. View Current Text"); - Console.WriteLine("3. Convert to UPPERCASE"); - Console.WriteLine("4. Convert to lowercase"); - Console.WriteLine("5. Count Characters"); - Console.WriteLine("6. Check if Contains Word"); - Console.WriteLine("7. Replace Word"); - Console.WriteLine("8. Extract Substring"); - Console.WriteLine("9. Trim Spaces"); - Console.WriteLine("10. Reset Text"); - Console.WriteLine("11. Exit"); - Console.WriteLine("===================================="); - } - - private void EnterText() - { - Console.Write("Enter your text: "); - string text = Console.ReadLine(); - _service.SetText(text); - Console.WriteLine("Text saved successfully."); - } - - private void ViewCurrentText() - { - Console.WriteLine($"Current Text: {_service.GetText()}"); - } - - private void CheckContains() - { - Console.Write("Enter word to check: "); - string word = Console.ReadLine(); - - bool result = _service.ContainsWord(word); - - if (result) - Console.WriteLine("The text contains the word."); - else - Console.WriteLine("The text does NOT contain the word."); - } - - private void ReplaceWord() - { - Console.Write("Enter word to replace: "); - string oldWord = Console.ReadLine(); - - Console.Write("Enter new word: "); - string newWord = Console.ReadLine(); - - _service.ReplaceWord(oldWord, newWord); - Console.WriteLine("Word replaced successfully."); - } - - private void ExtractSubstring() - { - Console.Write("Enter start index: "); - int start = int.Parse(Console.ReadLine()); - - Console.Write("Enter length: "); - int length = int.Parse(Console.ReadLine()); - - string result = _service.ExtractSubstring(start, length); - Console.WriteLine($"Extracted Substring: {result}"); - } - } -} From 2ea3d9df24ae1e244197ec8d8026bf6fd08f6b0c Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:39:06 +0800 Subject: [PATCH 6/9] Delete Program.cs --- Program.cs | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 Program.cs diff --git a/Program.cs b/Program.cs deleted file mode 100644 index c418fdf..0000000 --- a/Program.cs +++ /dev/null @@ -1,13 +0,0 @@ -using StringProcessingApp.Views; - -namespace StringProcessingApp -{ - internal class Program - { - static void Main(string[] args) - { - StringView view = new StringView(); - view.Run(); - } - } -} From 071dc02a9acdf752ff0c795a5181e21d0765e3b3 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:40:25 +0800 Subject: [PATCH 7/9] Create StringView.cs --- StringProcessingApp/Views/StringView.cs | 143 ++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 StringProcessingApp/Views/StringView.cs diff --git a/StringProcessingApp/Views/StringView.cs b/StringProcessingApp/Views/StringView.cs new file mode 100644 index 0000000..7c215af --- /dev/null +++ b/StringProcessingApp/Views/StringView.cs @@ -0,0 +1,143 @@ +using System; +using StringProcessingApp.Services; + +namespace StringProcessingApp.Views +{ + public class StringView + { + private readonly StringService _service; + + public StringView() + { + _service = new StringService(); + } + + public void Run() + { + bool running = true; + + while (running) + { + ShowMenu(); + Console.Write("Select an option: "); + string choice = Console.ReadLine(); + + Console.WriteLine(); + + switch (choice) + { + case "1": + EnterText(); + break; + case "2": + ViewCurrentText(); + break; + case "3": + _service.ToUpperCase(); + Console.WriteLine("Converted to UPPERCASE."); + break; + case "4": + _service.ToLowerCase(); + Console.WriteLine("Converted to lowercase."); + break; + case "5": + Console.WriteLine($"Character Count: {_service.CountCharacters()}"); + break; + case "6": + CheckContains(); + break; + case "7": + ReplaceWord(); + break; + case "8": + ExtractSubstring(); + break; + case "9": + _service.TrimSpaces(); + Console.WriteLine("Spaces trimmed."); + break; + case "10": + _service.Reset(); + Console.WriteLine("Text reset to original."); + break; + case "11": + running = false; + Console.WriteLine("Thank you for using the app, bye!"); + break; + default: + Console.WriteLine("Invalid choice. Please try again."); + break; + } + + Console.WriteLine(); + } + } + + private void ShowMenu() + { + Console.WriteLine("===== STRING PROCESSING SYSTEM ====="); + Console.WriteLine("1. Enter Text"); + Console.WriteLine("2. View Current Text"); + Console.WriteLine("3. Convert to UPPERCASE"); + Console.WriteLine("4. Convert to lowercase"); + Console.WriteLine("5. Count Characters"); + Console.WriteLine("6. Check if Contains Word"); + Console.WriteLine("7. Replace Word"); + Console.WriteLine("8. Extract Substring"); + Console.WriteLine("9. Trim Spaces"); + Console.WriteLine("10. Reset Text"); + Console.WriteLine("11. Exit"); + Console.WriteLine("===================================="); + } + + private void EnterText() + { + Console.Write("Enter your text: "); + string text = Console.ReadLine(); + _service.SetText(text); + Console.WriteLine("Text saved successfully."); + } + + private void ViewCurrentText() + { + Console.WriteLine($"Current Text: {_service.GetText()}"); + } + + private void CheckContains() + { + Console.Write("Enter word to check: "); + string word = Console.ReadLine(); + + bool result = _service.ContainsWord(word); + + if (result) + Console.WriteLine("The text contains the word."); + else + Console.WriteLine("The text does NOT contain the word."); + } + + private void ReplaceWord() + { + Console.Write("Enter word to replace: "); + string oldWord = Console.ReadLine(); + + Console.Write("Enter new word: "); + string newWord = Console.ReadLine(); + + _service.ReplaceWord(oldWord, newWord); + Console.WriteLine("Word replaced successfully."); + } + + private void ExtractSubstring() + { + Console.Write("Enter start index: "); + int start = int.Parse(Console.ReadLine()); + + Console.Write("Enter length: "); + int length = int.Parse(Console.ReadLine()); + + string result = _service.ExtractSubstring(start, length); + Console.WriteLine($"Extracted Substring: {result}"); + } + } +} From 2812860e04b20b8194b063c06ffdd65ce1250b69 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:41:46 +0800 Subject: [PATCH 8/9] Create StringService.cs --- StringProcessingApp/Services/StringService.cs | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 StringProcessingApp/Services/StringService.cs diff --git a/StringProcessingApp/Services/StringService.cs b/StringProcessingApp/Services/StringService.cs new file mode 100644 index 0000000..b382d00 --- /dev/null +++ b/StringProcessingApp/Services/StringService.cs @@ -0,0 +1,61 @@ +using System; + +namespace StringProcessingApp.Services +{ + public class StringService + { + private string _originalText = ""; + private string _currentText = ""; + + public void SetText(string text) + { + _originalText = text; + _currentText = text; + } + + public string GetText() + { + return _currentText; + } + + public void ToUpperCase() + { + _currentText = _currentText.ToUpper(); + } + + public void ToLowerCase() + { + _currentText = _currentText.ToLower(); + } + + public int CountCharacters() + { + return _currentText.Length; + } + + public bool ContainsWord(string word) + { + return _currentText.Contains(word); + } + + public void ReplaceWord(string oldWord, string newWord) + { + _currentText = _currentText.Replace(oldWord, newWord); + } + + public string ExtractSubstring(int startIndex, int length) + { + return _currentText.Substring(startIndex, length); + } + + public void TrimSpaces() + { + _currentText = _currentText.Trim(); + } + + public void Reset() + { + _currentText = _originalText; + } + } +} From f8bc2b7dd17264f3557dab8a9c715f982dc94d29 Mon Sep 17 00:00:00 2001 From: Dannicah Date: Sat, 28 Feb 2026 11:42:37 +0800 Subject: [PATCH 9/9] Create Program.cs --- StringProcessingApp/Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 StringProcessingApp/Program.cs diff --git a/StringProcessingApp/Program.cs b/StringProcessingApp/Program.cs new file mode 100644 index 0000000..c418fdf --- /dev/null +++ b/StringProcessingApp/Program.cs @@ -0,0 +1,13 @@ +using StringProcessingApp.Views; + +namespace StringProcessingApp +{ + internal class Program + { + static void Main(string[] args) + { + StringView view = new StringView(); + view.Run(); + } + } +}