12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #ifndef STRING_HPP
- #define STRING_HPP
- #include "IBoxing.hpp"
- #include "../base/Class.hpp"
- #include <string>
- namespace ls_std {
- class String : public Class, IBoxing {
- public:
- String();
- explicit String(std::string _value);
- ~String() = default;
-
- operator const char*() const;
- operator std::string() const;
-
- String& operator=(std::string _value);
-
- std::string operator+(String _string) const;
- std::string operator+(const std::string& _string) const;
- std::string operator+(const char* _string) const;
- std::string operator-(int _number);
-
- String& operator+=(String _string);
- String& operator+=(const std::string& _text);
-
- bool operator==(String _string);
- bool operator==(const std::string& _value);
- bool operator==(const char* _value);
- bool operator!=(String _string);
- bool operator!=(const std::string& _value);
- bool operator!=(const char* _value);
-
- void parse(std::string _parseText) override;
- std::string toString() override;
-
- bool contains(const std::string& _text);
- bool endsWith(const std::string& _text);
- bool equalsIgnoreCase(String _string);
- bool equalsIgnoreCase(std::string _text);
- std::string padLeft(size_t _width, const char _fillCharacter);
- std::string padRight(size_t _width, const char _fillCharacter);
- std::string reverse();
- bool startsWith(const std::string& _text);
- std::string toLowerCase();
- std::string toUpperCase();
- private:
- std::string value {};
- static std::string _buildCharacterChain(size_t _amount, const char _fillCharacter);
- static std::string _createFillContent(const std::string& _text, size_t _width, const char _fillCharacter);
- };
- }
- #endif
|