Skip to content

HamzaEldeeb/StringClass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StringClass

A custom implementation of a string data structure in C# built from scratch using a character array.

This project recreates many of the core features provided by the .NET String class without relying on the built-in implementation. The goal was to deeply understand how string operations work internally and strengthen problem-solving, data structures, algorithms, and object-oriented programming skills.


📖 Project Overview

StringClass is a custom string implementation that stores data internally using a char[] array and provides many common string manipulation methods.

Instead of depending on the built-in String methods, most operations are implemented manually using loops, arrays, collections, and custom algorithms.

This project was created as a learning exercise to understand how string manipulation works behind the scenes.


✨ Features

Basic Operations

  • Length Property
  • ToString()
  • Clone()
  • Equals()
  • EqualsIgnoreCase()
  • CompareTo()
  • GetHashCode()

Searching

  • IndexOf()
  • LastIndexOf()
  • Contains()
  • Searching()

String Manipulation

  • Substring()
  • Insert()
  • Remove()
  • Replace()
  • ReplaceSubstring()

Split Operations

  • Split()
  • SplitByLength()
  • SplitLine()
  • GetWords()

Formatting

  • Trim()
  • TrimStart()
  • TrimEnd()
  • Normalize()
  • ToTitleCase()

Padding

  • PadLeft()
  • PadRight()

Utility Methods

  • Reverse()
  • RemoveSpacing()
  • NumberOfChar()
  • CountOccurrences()

Validation Methods

  • IsNullOrEmpty()
  • IsNullOrWhiteSpace()

Advanced Methods

  • Join()
  • StartsWith()
  • EndsWith()
  • Truncate()
  • SubstringBefore()
  • SubstringAfter()

Operators Overloading

  • '+' Operator
  • == Operator
  • != Operator
  • Implicit conversion from string
  • Implicit conversion from char[]

Indexers

  • Access character by index
  • Access multiple characters using multiple indexes

🛠 Technologies Used

  • C#
  • .NET
  • Object-Oriented Programming (OOP)
  • Data Structures
  • Algorithms

📚 What I Learned

Through building this project, I learned:

  • How strings are stored internally.
  • Working directly with character arrays.
  • Implementing common string algorithms manually.
  • Building reusable and maintainable code.
  • Operator Overloading.
  • Indexers.
  • Defensive Programming and Validation.
  • Memory management concepts.
  • Problem Solving techniques.
  • Designing custom data structures.
  • Improving code organization and readability.

🎯 Challenges

Some challenges faced during development:

  • Implementing string searching algorithms.
  • Managing indexes safely.
  • Handling edge cases.
  • Designing methods similar to the .NET String API.
  • Keeping operations efficient while maintaining readability.

🚀 Future Improvements

Possible future enhancements:

  • IEnumerable support.
  • Generic interfaces implementation.
  • Better hash code generation.
  • Additional string comparison options.
  • Performance optimizations.
  • Unit testing.

👨‍💻 Author

Hamza Eldeeb

Passionate about learning Computer Science fundamentals, Data Structures, Algorithms, OOP, and Backend Development using C#.


⭐ Project Purpose

This project was built for educational purposes to understand how string manipulation works internally and to improve software engineering and problem-solving skills.

About

Custom String class implementation in C# built from scratch using char arrays, OOP principles, and string algorithms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages