The String Operations App is a web-based application built with Next.js that allows users to perform various operations on strings. It provides a user-friendly interface where users can input a string, select an operation, and view the result in real-time. The app supports a wide range of string operations, including reversing, converting case, counting characters, checking for palindromes, and more. Additionally, it includes advanced features like detecting and executing functions within the input string.
- Reverse: Reverses the input string.
- Uppercase: Converts the input string to uppercase.
- Lowercase: Converts the input string to lowercase.
- Count Characters: Counts the number of characters in the input string.
- Split Characters: Splits the input string into individual characters.
- Check Palindrome: Checks if the input string is a palindrome.
- Check for Object: Detects if the input string contains a valid JSON object.
- Check for Boolean: Detects if the input string contains a boolean value (
trueorfalse). - Check for Array: Detects if the input string contains a valid JSON array.
- Check for Number: Detects if the input string contains numeric values.
- Check for Special Characters: Detects if the input string contains special characters.
- Check for Function: Detects if the input string contains a function, identifies its location, and executes it (with
varandletforced intoconstfor safer execution).
- The app is fully responsive and works seamlessly on both mobile and desktop screens.
- On mobile devices, the layout stacks the input and result sections vertically.
- On desktop devices, the layout displays the input and result sections side by side.
- The app uses custom CSS for styling, ensuring a clean and modern design.
- Features like hover effects, transitions, and gradients enhance the user experience.
- The result of the selected operation is displayed in real-time.
- The result section is scrollable, making it easy to view long outputs.
-
Input a String:
- Enter your string in the textarea provided in the left column.
-
Select an Operation:
- Choose an operation from the dropdown menu. The available operations include:
- Reverse
- Uppercase
- Lowercase
- Count Characters
- Split Characters
- Check Palindrome
- Check for Object
- Check for Boolean
- Check for Array
- Check for Number
- Check for Special Characters
- Check for Function
- Choose an operation from the dropdown menu. The available operations include:
-
Perform the Operation:
- Click the Perform Operation button to execute the selected operation.
-
View the Result:
- The result of the operation will be displayed in the right column. If the result is an object or array, it will be formatted for easy readability.
To run this application locally, follow these steps:
- Node.js (v16 or higher)
- npm (v8 or higher)
-
Clone the Repository:
git clone https://github.com/Akins20/stringtester.git cd string-operations-app -
Install Dependencies:
npm install
-
Run the Application:
npm run dev
-
Open the App:
- Open your browser and navigate to
http://localhost:3000.
- Open your browser and navigate to
string-operations-app/
├── public/ # Static assets
├── src/
│ ├── pages/ # Next.js pages
│ │ ├── index.js # Homepage component
│ ├── styles/ # CSS files
│ │ ├── Homepage.module.css # Custom CSS for the homepage
│ ├── utils/ # Utility functions
│ │ ├── utils.js # String operation functions
├── package.json # Project dependencies
├── README.md # Project documentation
- Next.js: A React framework for building server-rendered applications.
- React: A JavaScript library for building user interfaces.
- CSS Modules: For scoped and modular CSS styling.
- JavaScript: For implementing the logic and functionality of the app.
To add a new operation:
- Open the
utils.jsfile in thesrc/utils/directory. - Add a new function to perform the desired operation.
- Update the
handleOperationfunction in theHomepagecomponent to include the new operation.
To customize the styling:
- Open the
Homepage.module.cssfile in thesrc/directory. - Modify the CSS classes as needed.
- Input:
Hello, World! - Operation: Reverse
- Output:
!dlroW ,olleH
- Input:
{"name": "John", "age": 30} - Operation: Check for Object
- Output:
The string contains an object! { "name": "John", "age": 30 }
- Input:
function greet() { console.log("Hello, world!"); } greet();
- Operation: Check for Function
- Output:
Function "greet" found and executed.
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Push your branch and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Next.js for providing a powerful framework for building React applications.
- Tailwind CSS for inspiration on responsive design and utility-first CSS.
For questions or feedback, please reach out to:
- Name: ogunbiye@gmail.com
- GitHub: Akins20
Enjoy using the String Operations App! 🚀