Git Product home page Git Product logo

strutil's People

Contributors

eltociear avatar fwilliams avatar gustavlindberg99 avatar jphill4 avatar nblog avatar somerandomdev49 avatar tgalaj avatar xzzx avatar zhongjingjogy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

strutil's Issues

Consecutive/Multiple Delimiters?

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.

You could add more

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

}

Allow other container types than std::vector where it makes sense

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.