A custom C++ String Utility Library implemented using Object-Oriented Programming (OOP) principles.
This library contains a collection of commonly used string manipulation algorithms organized inside a reusable class called clsString.
The goal of this project is to demonstrate how to transform algorithm-based functions into a clean, reusable, and maintainable C++ library.
- Project Overview
- Features
- Concepts Applied
- Project Structure
- Example Usage
- Example Output
- Future Improvements
- Learning Source
Working with strings is one of the most common tasks in programming.
Instead of rewriting string functions repeatedly, this project organizes many useful string algorithms into a single reusable class library.
The project demonstrates how Object-Oriented Programming can be used to design reusable components that improve code structure and maintainability.
The clsString class provides many useful utilities for working with strings.
- Count words in a string
- Print each word
- Reverse words order
- Split string into words
- Join words into a string
- Convert string to Uppercase
- Convert string to Lowercase
- Capitalize the first letter of each word
- Invert letter case
- Count capital letters
- Count small letters
- Count specific characters
- Count vowels
- Print vowels in a string
- Trim left spaces
- Trim right spaces
- Trim full string
- Remove punctuation
- Replace words in a string
- Reverse words
- Modify characters
This project demonstrates several core programming concepts:
- Object-Oriented Programming (OOP)
- Encapsulation
- Function Overloading
- Static Methods
- Code Reusability
- Clean Code Practices
- Algorithm Implementation
Project-8-String-Library-OOP
│
├── clsString.h
│ String utility class containing all string operations
│
└── main.cpp
Example program demonstrating how to use the library
#include <iostream>
#include "clsString.h"
using namespace std;
int main()
{
clsString String1("Ahmed Yaser");
cout << "String1 = " << String1.Value << endl;
cout << "Number of words: "
<< String1.CountWords() << endl;
String1.UpperFirstLetterOfEachWord();
cout << "After Capitalizing: "
<< String1.Value << endl;
String1.ReverseWordsInString();
cout << "Reversed Words: "
<< String1.Value << endl;
String1.ReplaceWord("Ahmed", "Ibrahim");
cout << "After Replace: "
<< String1.Value << endl;
return 0;
}String1 = Ahmed Yaser
Number of words: 2
After Capitalizing: Ahmed Yaser
Reversed Words: Yaser Ahmed
After Replace: Ibrahim Yaser
This project was implemented while following the Programming Advices Roadmap
Instructor
Dr. Mohammed Abu-Hadhoud
The project demonstrates how to convert algorithm-based code into clean and reusable object-oriented libraries.