Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme #7

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
## UTF-8 String For C++ (utf8::ustring)
## ⚙️ UTF-8 String For C++ (utf8::ustring)

## Brief Description:
This is an implementation of the UTF-8 encoding standard for C++, the implementation is based on the std::basic_string\<char\> class, this gives us the advantage of std::basic_string\<char\> class functions, as well as compatibility with some functions from the standard library.
## 📜 Brief Description:
This is an implementation of the `UTF-8` encoding standard for `C++`, the implementation is based on the `std::basic_string<char>` class, this gives us the advantage of `std::basic_string<char>` class functions, as well as compatibility with some functions from the standard library.

## Code Style:
- C++ AStyle code style was used for this project.
## 📝 Code Style:
- `C++ AStyle` code style was used for this project.

## Technical Dependencies:
- C++ 20
- CMake 3.14
## 🛠 Technical Dependencies:
- `C++ 20`
- `CMake 3.14`

## Support Status On Systems:
- [X] Linux
- [ ] Windows (not yet verified)
## 🔗 Support Status On Systems:
- [X] Linux (verified on clang)
- [X] Windows (verified on gcc && clang)

## Library Features:
## 💫 Library Features:
- Support for creating an object from: `std::string, std::string_view, const char*`
- Comparing an `utf8::ustring` with `utf8::ustring` (comparison with `const char*`, `std::string`, `std::string_view` will be added in the future)
- Copy/Move (<- assignment also) constructor implemented
- O(1) Random Access
- Simple replacement of any character, e.g. a smaller character (1 byte) with a larger character (2-3-4 bytes).
- Simple replacement of any character, e.g. a smaller character `(1 byte)` with a larger character `(2-3-4 bytes)`.

## Performance Test:
## ⚡️ Performance Test:
| String-Version | Test-Name | iteration count | time (for all iterations) |
|:--------------:|:-----------------------:|:---------------:|:-------------------------:|
| std::string | replace_char | 500'000 | ~0.57s |
| utf8::ustring | replace_char | 500'000 | ~0.60s |

## Coming Soon:
- A more detailed test and description of the string speed.
- Test in Windows.
- Introduction of new functions.
- Code samples.
## ❔ Replace Char O(1) ?
Yes and no, in the case where we replace a character with another `with the same size`, we have `O(1)`, in the other case we have `O(~N)`, where N is the length of the string.
But in any case we have `O(1) Random Access`.

<div style="text-align: center;">
© 2024 Andrii (AKA b1tflyyyy). All rights reserved.
</div>
## 📚 Code Samples:
```cpp
std::string str{ "hello world!" };
utf8::ustring ustr{ str };

ustr.replace_char("п", 0); // "пello world!"

ustr == "hi !"; // false
ustr == str; // false
```

## ⭐️ Coming Soon:
- Write/read to file.
- Add new features.
- Docs.

### © 2024 Andrii (AKA b1tflyyyy). All rights reserved.
Loading