Good C++ string manipulation library

后端 未结 7 1036
梦谈多话
梦谈多话 2021-01-30 01:05

I\'m sorry for flaming std::string and std::wstring. They are quite limited and far from being thread safe. Performance wise, they are not that good too. I miss simple features

7条回答
  •  逝去的感伤
    2021-01-30 01:30

    For conversion, you can always break down and use the C library cstdlib.

    #include 
    #include 
    
    int main()
    {
       std::string num;
    
       std::cin >> num;
    
       someFunc(atoi(num));
       someOtherFunc(atof(num));
       return 0;
    }
    

    atoi = ascii to integer atof = ascii to float

    As for find, use the STL function "find" defined under header algorithm, or find_first_of (or similar). I also believe you can initialize a vector of char's with an std::string, but that is conjecture.

提交回复
热议问题