GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - hun1er/stringpy: A C++17 library providing a set of string manipulation functions, many of which are similar to Python string methods.

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cmake
cmake
 
 
data/logo
data/logo
 
 
docs
docs
 
 
examples
examples
 
 
include/stringpy
include/stringpy
 
 
src
src
 
 
tests
tests
 
 
.clang-format
.clang-format
 
 
.clang-tidy
.clang-tidy
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CMakePresets.json
CMakePresets.json
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
stringpy.rc.in
stringpy.rc.in
 
 

Repository files navigation

StringPy

📚 A C++17 string manipulation library

Release codecov License

Provides a set of string manipulation functions, many of which are similar to Python string methods.

🌟 Features

  • Flexible Comparison Options: Compare strings using either case-sensitive or case-insensitive matching.

  • Flexible String Matching: Find substrings within strings using either case-sensitive or case-insensitive matching.

  • String Splitting and Joining: Split strings into substrings based on specified delimiters or join multiple strings together with a specified delimiter.

  • String Transformation: Transform strings in various ways, such as capitalizing the first letter of each word, centering text within a specified width, expanding tabs to spaces, justifying text to the left or right, replacing substrings with new values, swapping the case of characters or converting them to uppercase or lowercase, etc.

  • String Trimming: Remove leading and trailing whitespace or specific characters from strings.

  • String Formatting: Provides a very simple yet fast string formatting function. It's at least two times faster than typical solutions based on std::snprintf, such as this one (tested with Google Benchmark). Additionally, this function is safe and does not throw exceptions, even if passed a nullptr as an argument.

  • Character and String Classification: Determine the type of character or string, such as whether it is alphanumeric, alphabetic, ASCII, a digit, graphical, printable, punctuation, whitespace, etc.

And more.

💪 Robust and Reliable

Each function has been thoroughly tested with unit tests to ensure its correctness and reliability. Additionally, the functions in this library do not throw exceptions and do not use RTTI (Run-Time Type Information), making them safe and easy to use in any project.

🌎 Cross-Platform and Dependency-Free

This library is completely self-contained and does not have any external dependencies (except STL). It can be used on any platform that supports C++17 (Windows, Linux, macOS).

💻 Usage

There are several ways to include StringPy in your project, such as adding it as a submodule, manually copying the files, or compiling and installing the library.

However, one of the easiest approaches is to use CMake FetchContent. To do this, add the following lines to your CMakeLists.txt file:

include(FetchContent)

FetchContent_Declare(
  StringPy
  GIT_REPOSITORY https://github.com/hun1er/stringpy.git
  GIT_TAG        v1.0.2
)

FetchContent_MakeAvailable(StringPy)

Then you can use the targets and functions of StringPy in other CMakeLists.txt files in your project. For example:

target_link_libraries(my_target PRIVATE StringPy::stringpy)

Once you have included StringPy in your project, you can use it by including the header files and calling the desired functions. For example:

#include <stringpy/stringpy.hpp>

int main()
{
    std::string str = "hello, world!";
    std::string result = strpy::title(str);
    std::cout << result << std::endl; // prints "Hello, World!"

    return 0;
}

📖 Documentation and Examples

Comprehensive documentation for each function, including detailed descriptions, parameter explanations, and practical examples.

💬 Contributions

Contributions are highly appreciated! If you have any ideas for new features, bug fixes, or improvements, please feel free to open an issue or submit a pull request.

📜 License

StringPy is released under the MIT License. You are free to use, modify, and distribute this library in your own projects.

About

A C++17 library providing a set of string manipulation functions, many of which are similar to Python string methods.

stringpy.rf.gd

Topics

c-plus-plusc-plus-plus-17cppcpp17cross-platformstringstring-functionsstring-librarystring-manipulationstrings

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.