tgalaj / strutil Goto Github PK
View Code? Open in Web Editor NEWHeader only C++ string utility library
License: MIT License
Header only C++ string utility library
License: MIT License
This looks great; thank you for making it available. I go back and forth between C++ and Python and hate having to do string ops in C++. Quick question... does this support (1) splitting on multiple delimiters and (2) treating consecutive delimiters as one? Quick look suggests no, but wanted to ask.
before/after Last/First Cha
Example
std::string beforeLastChar(const std::string& str, char target) {
size_t lastPos = str.find_last_of(target);
if (lastPos != std::string::npos) {
return str.substr(0, lastPos);
}
return str; // Return the whole string if the character is not found
}
I'm trying to use join
on an std::set, but the function can only take an std::vector. Your implementation doesn't seem to do anything that can't be done with a set, so I suggest you make it a template so that it can take any container. Unless I'm missing something, it should work fine if you simply change the signature to
template<typename Container>
static inline std::string join(const Container & tokens, const std::string & delim)
Also you have some other functions that use std::vector where other containers would also work. Maybe you could go through them and see which ones could support other containers as well.
We need version tags to be able to know that we use the desired version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.