12#include <initializer_list> 
   13#include "boost/algorithm/string/replace.hpp" 
   14#include "Arp/System/Core/BasicFormatter.hxx" 
   15#include "Arp/System/Core/Impl/BasicStringFormatExceptionHandler.hpp" 
   17#ifndef ARP_USE_ARP_SYSTEM_CORE 
   23#ifndef ARP_INSIDE_ARP_H 
   24    #error Never include 'BasicString.hxx' directly, just include 'Arp.h' 
   37template<
class C, 
class Alloc = std::allocator<C>>
 
   41    using Allocator         = Alloc;                                                                
 
   42    using AllocatorTraits   = std::allocator_traits<Alloc>;
 
   44    using SelfType          = BasicString<CharType, Allocator>;                                     
 
   45    using BaseString        = std::basic_string<CharType, std::char_traits<CharType>, Allocator>;   
 
   46    using StdString         = std::basic_string<CharType, std::char_traits<CharType>, Allocator>;   
 
   47    using Tokens            = std::vector<SelfType>;                                                
 
   48    using Bytes             = std::vector<byte>;                                                    
 
   51    using allocator_type            = Allocator;                                    
 
   52    using value_type                = CharType;                                     
 
   53    using size_type                 = 
typename BaseString::size_type;               
 
   54    using difference_type           = 
typename BaseString::difference_type;         
 
   55    using reference                 = 
typename BaseString::reference;               
 
   56    using const_reference           = 
typename BaseString::const_reference;         
 
   57    using pointer                   = 
typename AllocatorTraits::pointer;            
 
   58    using const_pointer             = 
typename AllocatorTraits::const_pointer;      
 
   59    using iterator                  = 
typename BaseString::iterator;                
 
   60    using const_iterator            = 
typename BaseString::const_iterator;          
 
   61    using reverse_iterator          = 
typename BaseString::reverse_iterator;        
 
   62    using const_reverse_iterator    = 
typename BaseString::const_reverse_iterator;  
 
   65    using BasicFormatterType = BasicFormatter<CharType, Allocator>;
 
   69    BasicString() = 
default;
 
   73    BasicString(
const SelfType& arg) = 
default;
 
   78    BasicString(
const SelfType& arg, 
const Allocator& alloc)
 
   79        : baseString(arg.baseString, alloc)
 
   85    explicit BasicString(
const Allocator& alloc)
 
   94    BasicString(
const SelfType& arg, size_type offset, size_type count = NPos)
 
   95        : baseString(arg.baseString, offset, count)
 
  104    BasicString(
const SelfType& arg, size_type offset, size_type count, 
const Allocator& alloc)
 
  105        : baseString(arg.baseString, offset, count, alloc)
 
  112    BasicString(
const CharType* pChars, size_type count)
 
  113        : baseString(pChars, count)
 
  121    BasicString(
const CharType* pChars, size_type count, 
const Allocator& alloc)
 
  122        : baseString(pChars, count, alloc)
 
  128    BasicString(
const CharType* pChars)
 
  135    BasicString(
const char8u* pChars)
 
  136        : BasicString(reinterpret_cast<const char*>(pChars))
 
  143    BasicString(
const CharType* pChars, 
const Allocator& alloc)
 
  144        : baseString(pChars, alloc)
 
  151    BasicString(size_type count, CharType c)
 
  152        : baseString(count, c)
 
  160    BasicString(size_type count, CharType c, 
const Allocator& alloc)
 
  161        : baseString(count, c, alloc)
 
  167    BasicString(SelfType&& arg) 
noexcept = 
default;
 
  172    BasicString(SelfType&& arg, 
const Allocator& alloc)
 
  173        : baseString(
std::move(arg.baseString), alloc)
 
  180    BasicString(std::initializer_list<CharType> arg, 
const Allocator& alloc = Allocator())
 
  181        : baseString(arg, alloc)
 
  189    BasicString(iterator first, iterator last, 
const Allocator& alloc = Allocator())
 
  190        : baseString(first, last, alloc)
 
  198    BasicString(const_iterator first, const_iterator last, 
const Allocator& alloc = Allocator())
 
  199        : baseString(first, last, alloc)
 
  206    explicit BasicString(
const Bytes& bytes, 
const Allocator& alloc = Allocator())
 
  207        : baseString(reinterpret_cast<const char*>(bytes.data()), reinterpret_cast<const char*>(bytes.data() + bytes.size()), alloc)
 
  213    BasicString(
const BaseString& arg)
 
  220    BasicString(BaseString&& arg)
 
  221        : baseString(
std::move(arg))
 
  226    ~BasicString() = 
default;
 
  233    static const size_type  NPos = size_type(-1);
 
  237    static const SelfType   
Empty;
 
  241    static const SelfType   NewLine;
 
  247    SelfType& operator=(SelfType&& right) 
noexcept = 
default;
 
  252    SelfType& operator=(std::initializer_list<CharType> right)
 
  254        this->baseString = right;
 
  261    SelfType& operator=(
const SelfType& right) = 
default;
 
  266    SelfType& operator=(
const CharType* right)
 
  268        this->baseString = right;
 
  275    SelfType& operator=(CharType c)
 
  277        this->baseString = c;
 
  285    SelfType& operator+=(std::initializer_list<CharType> right)
 
  287        this->baseString += right;
 
  294    SelfType& operator+=(
const SelfType& right)
 
  296        this->baseString += right.baseString;
 
  303    SelfType& operator+=(
const CharType* right)
 
  305        this->baseString += right;
 
  312    SelfType& operator+=(CharType c)
 
  314        this->baseString += c;
 
  323    SelfType& Assign(SelfType&& arg)
 
  325        this->baseString = std::move(arg.baseString);
 
  332    SelfType& Assign(std::initializer_list<CharType> arg)
 
  334        this->baseString.assign(arg);
 
  341    SelfType& Assign(
const SelfType& arg)
 
  343        this->baseString.assign(arg.baseString);
 
  351    SelfType& Assign(
const SelfType& arg, size_type offset, size_type count = NPos)
 
  353        this->baseString.assign(arg.baseString, offset, count);
 
  360    SelfType& Assign(
const BaseString& arg)
 
  362        this->baseString.assign(arg);
 
  369    SelfType& Assign(BaseString&& arg)
 
  371        this->baseString.assign(std::move(arg));
 
  378    SelfType& Assign(
const CharType* pChars, size_type count)
 
  380        this->baseString.assign(pChars, count);
 
  386    SelfType& Assign(
const CharType* pChars)
 
  388        this->baseString.assign(pChars);
 
  395    SelfType& Assign(size_type count, CharType c)
 
  397        this->baseString.assign(count, c);
 
  404    SelfType& Assign(iterator first, iterator last)
 
  406        this->baseString.assign(first, last);
 
  413    SelfType& Assign(const_iterator first, const_iterator last)
 
  415        this->baseString.assign(first, last);
 
  422    SelfType& Assign(const_pointer first, const_pointer last)
 
  424        this->baseString.assign(first, last);
 
  433    SelfType& 
Append(std::initializer_list<CharType> arg)
 
  435        this->baseString.append(arg);
 
  442    SelfType& 
Append(
const SelfType& arg)
 
  444        this->baseString.append(arg.baseString);
 
  452    SelfType& 
Append(
const SelfType& arg, size_type offset, size_type count = NPos)
 
  454        this->baseString.append(arg.baseString, offset, count);
 
  461    SelfType& 
Append(
const CharType* pChars, size_type count)
 
  463        this->baseString.append(pChars, count);
 
  469    SelfType& 
Append(
const CharType* pChars)
 
  471        this->baseString.append(pChars);
 
  478    SelfType& 
Append(size_type count, CharType c)
 
  480        this->baseString.append(count, c);
 
  487    SelfType& 
Append(iterator first, iterator last)
 
  489        this->baseString.append(first, last);
 
  496    SelfType& 
Append(const_iterator first, const_iterator last)
 
  498        this->baseString.append(first, last);
 
  505    SelfType& 
Append(const_pointer first, const_pointer last)
 
  507        this->baseString.append(first, last);
 
  517    iterator Insert(const_iterator where, std::initializer_list<CharType> arg)
 
  519        return this->baseString.insert(where, arg);
 
  526    SelfType& Insert(size_type offset, 
const SelfType& arg)
 
  528        this->baseString.insert(offset, arg.baseString);
 
  538    SelfType& Insert(size_type offset, 
const SelfType& arg, size_type argOffset, size_type count = NPos)
 
  540        this->baseString.insert(offset, arg.baseString, argOffset, count);
 
  549    SelfType& Insert(size_type offset, 
const CharType* pChars, size_type count)
 
  551        this->baseString.insert(offset, pChars, count);
 
  559    SelfType& Insert(size_type offset, 
const CharType* pChars)
 
  561        this->baseString.insert(offset, pChars);
 
  570    SelfType& Insert(size_type offset, size_type count, CharType c)
 
  572        this->baseString.insert(offset, count, c);
 
  580    iterator Insert(const_iterator where, CharType c)
 
  582        return this->baseString.insert(where, c);
 
  590    iterator Insert(const_iterator where, size_type count, CharType c)
 
  592        return this->baseString.insert(where, count, c);
 
  600    iterator Insert(const_iterator where, iterator first, iterator last)
 
  602        return this->baseString.insert(where, first, last);
 
  610    iterator Insert(const_iterator where, const_iterator first, const_iterator last)
 
  612        return this->baseString.insert(where, first, last);
 
  620    iterator Insert(const_iterator where, const_pointer first, const_pointer last)
 
  622        return this->baseString.insert(where, first, last);
 
  630    SelfType& Erase(size_type offset = 0)
 
  632        this->baseString.erase(offset);
 
  640    SelfType& Erase(size_type offset, size_type count)
 
  642        this->baseString.erase(offset, count);
 
  649    iterator Erase(const_iterator where)
 
  651        return this->baseString.erase(where);
 
  658    iterator Erase(const_iterator first, const_iterator last)
 
  660        return this->baseString.erase(first, last);
 
  670    SelfType& Replace(const_iterator first, const_iterator last, std::initializer_list<CharType> chars)
 
  672        this->baseString.replace(first, last, chars);
 
  681    SelfType& Replace(size_type offset, size_type length, 
const SelfType& arg)
 
  683        this->baseString.replace(offset, length, arg.baseString);
 
  694    SelfType& Replace(size_type offset, size_type length, 
const SelfType& arg, size_type offsetArg, size_type count = NPos)
 
  696        this->baseString.replace(offset, length, arg.baseString, offsetArg, count);
 
  706    SelfType& Replace(size_type offset, size_type length, 
const CharType* pChars, size_type count)
 
  708        this->baseString.replace(offset, length, pChars, offset, count);
 
  717    SelfType& Replace(size_type offset, size_type length, 
const CharType* pChars)
 
  719        this->baseString.replace(offset, length, pChars);
 
  729    SelfType& Replace(size_type offset, size_type length, size_type count, CharType c)
 
  731        this->baseString.replace(offset, length, count, c);
 
  740    SelfType& Replace(const_iterator first, const_iterator last, 
const SelfType& arg)
 
  742        this->baseString.replace(first, last, arg.baseString);
 
  752    SelfType& Replace(const_iterator first, const_iterator last, 
const CharType* pChars, size_type count)
 
  754        this->baseString.replace(first, last, pChars, count);
 
  763    SelfType& Replace(const_iterator first, const_iterator last, 
const CharType* pChars)
 
  765        this->baseString.replace(first, last, pChars);
 
  775    SelfType& Replace(const_iterator first, const_iterator last, size_type count, CharType c)
 
  777        this->baseString.replace(first, last, count, c);
 
  787    SelfType& Replace(const_iterator first, const_iterator last, iterator first2, iterator last2)
 
  789        this->baseString.replace(first, last, first2, last2);
 
  799    SelfType& Replace(const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
 
  801        this->baseString.replace(first, last, first2, last2);
 
  811    SelfType& Replace(const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
 
  813        this->baseString.replace(first, last, first2, last2);
 
  823    SelfType& Replace(const_iterator first, const_iterator last, pointer first2, pointer last2)
 
  825        this->baseString.replace(first, last, first2, last2);
 
  836    SelfType& ReplaceAll(
const SelfType& pattern, 
const SelfType& replacement)
 
  838        boost::replace_all(this->baseString, pattern.baseString, replacement.baseString);
 
  849        return this->baseString.begin();
 
  855    const_iterator begin()
 const 
  857        return this->baseString.begin();
 
  865        return this->baseString.end();
 
  871    const_iterator end()
 const 
  873        return this->baseString.end();
 
  882        return this->baseString.begin();
 
  887    const_iterator Begin()
 const 
  889        return this->baseString.begin();
 
  896        return this->baseString.end();
 
  901    const_iterator End()
 const 
  903        return this->baseString.end();
 
  908    reverse_iterator ReverseBegin()
 
  910        return this->baseString.rbegin();
 
  915    const_reverse_iterator ReverseBegin()
 const 
  917        return this->baseString.rbegin();
 
  922    reverse_iterator ReverseEnd()
 
  924        return this->baseString.rend();
 
  929    const_reverse_iterator ReverseEnd()
 const 
  931        return this->baseString.rend();
 
  936    const_iterator ConstBegin()
 const 
  938        return this->baseString.cbegin();
 
  943    const_iterator ConstEnd()
 const 
  945        return this->baseString.cend();
 
  950    const_reverse_iterator ConstReverseBegin()
 const 
  952        return this->baseString.crbegin();
 
  957    const_reverse_iterator ConstReverseEnd()
 const 
  959        return this->baseString.crend();
 
  965        this->baseString.shrink_to_fit();
 
  970    void PushBack(CharType c)
 
  972        this->baseString.push_back(c);
 
  981            this->baseString.pop_back();
 
  990        return this->baseString.front();
 
  996    const_reference Front()
 const 
  998        return this->baseString.front();
 
 1006        return this->baseString.back();
 
 1012    const_reference Back()
 const 
 1014        return this->baseString.back();
 
 1021    reference At(size_type offset)
 
 1023        return this->baseString.at(offset);
 
 1030    const_reference At(size_type offset)
 const 
 1032        return this->baseString.at(offset);
 
 1039    reference operator[](size_type offset)
 
 1041        return this->baseString[offset];
 
 1048    const_reference operator[](size_type offset)
 const 
 1050        return this->baseString[offset];
 
 1064        return this->baseString.length();
 
 1074    size_type Size()
 const 
 1076        return this->baseString.size();
 
 1080    size_type MaxSize()
 const 
 1082        return this->baseString.max_size();
 
 1092    size_type Capacity()
 const 
 1094        return this->baseString.capacity();
 
 1099    bool IsEmpty()
 const 
 1101        return this->baseString.empty();
 
 1110    void Resize(size_type newSize)
 
 1112        this->baseString.resize(newSize);
 
 1122    void Resize(size_type newSize, CharType c)
 
 1124        this->baseString.resize(newSize, c);
 
 1134    void Reserve(size_type newCapacity = 0)
 
 1136        this->baseString.reserve(newCapacity);
 
 1142        this->baseString.clear();
 
 1151    size_type Find(
const SelfType& pattern, size_type offset = 0)
 const 
 1153        return this->baseString.find(pattern.baseString, offset);
 
 1161    size_type Find(
const CharType* pChars, size_type offset, size_type count)
 const 
 1163        return this->baseString.find(pChars, offset, count);
 
 1170    size_type Find(
const CharType* pChars, size_type offset = 0)
 const 
 1172        return this->baseString.find(pChars, offset);
 
 1179    size_type Find(CharType c, size_type offset = 0)
 const 
 1181        return this->baseString.find(c, offset);
 
 1188    size_type ReverseFind(
const SelfType& pattern, size_type offset = NPos)
 const 
 1190        return this->baseString.rfind(pattern.baseString, offset);
 
 1198    size_type ReverseFind(
const CharType* pChars, size_type offset, size_type count)
 const 
 1200        return this->baseString.rfind(pChars, offset, count);
 
 1207    size_type ReverseFind(
const CharType* pChars, size_type offset = NPos)
 const 
 1209        return this->baseString.rfind(pChars, offset);
 
 1216    size_type ReverseFind(CharType c, size_type offset = NPos)
 const 
 1218        return this->baseString.rfind(c, offset);
 
 1225    size_type FindFirstOf(
const SelfType& chars, size_type offset = 0)
 const 
 1227        return this->baseString.find_first_of(chars.baseString, offset);
 
 1235    size_type FindFirstOf(
const CharType* pChars, size_type offset, size_type count)
 const 
 1237        return this->baseString.find_first_of(pChars, offset, count);
 
 1244    size_type FindFirstOf(
const CharType* pChars, size_type offset = 0)
 const 
 1246        return this->baseString.find_first_of(pChars, offset);
 
 1254    size_type FindFirstOf(CharType c, size_type offset = 0)
 const 
 1256        return this->baseString.find_first_of(c, offset);
 
 1263    size_type FindLastOf(
const SelfType& chars, size_type pos = NPos)
 const 
 1265        return this->baseString.find_last_of(chars.baseString, pos);
 
 1273    size_type FindLastOf(
const CharType* pChars, size_type pos, size_type count)
 const 
 1275        return this->baseString.find_last_of(pChars, pos, count);
 
 1282    size_type FindLastOf(
const CharType* pChars, size_type pos = NPos)
 const 
 1284        return this->baseString.find_last_of(pChars, pos);
 
 1292    size_type FindLastOf(CharType c, size_type pos = NPos)
 const 
 1294        return this->baseString.find_last_of(c, pos);
 
 1301    size_type FindFirstNotOf(
const SelfType& chars, size_type offset = 0)
 const 
 1303        return this->baseString.find_first_not_of(chars.baseString, offset);
 
 1311    size_type FindFirstNotOf(
const CharType* pChars, size_type offset, size_type count)
 const 
 1313        return this->baseString.find_first_not_of(pChars, offset, count);
 
 1320    size_type FindFirstNotOf(
const CharType *pChars, size_type offset = 0)
 const 
 1322        return this->baseString.find_first_not_of(pChars, offset);
 
 1330    size_type FindFirstNotOf(CharType c, size_type offset = 0)
 const 
 1332        return this->baseString.find_first_not_of(c, offset);
 
 1339    size_type FindLastNotOf(
const SelfType& chars, size_type pos = NPos)
 const 
 1341        return this->baseString.find_last_not_of(chars.baseString, pos);
 
 1349    size_type FindLastNotOf(
const CharType *pChars, size_type pos, size_type count)
 const 
 1351        return this->baseString.find_last_not_of(pChars, pos, count);
 
 1358    size_type FindLastNotOf(
const CharType *pChars, size_type pos = NPos)
 const 
 1360        return this->baseString.find_last_not_of(pChars, pos);
 
 1368    size_type FindLastNotOf(CharType c, size_type pos = NPos)
 const 
 1370        return this->baseString.find_last_not_of(c, pos);
 
 1382    int Compare(
const SelfType& other)
 const 
 1384        return this->baseString.compare(other.baseString);
 
 1396    int Compare(size_type offset, size_type count, 
const SelfType& other)
 const 
 1398        return this->baseString.compare(offset, count, other.baseString);
 
 1412    int Compare(size_type offset, size_type count, 
const SelfType& other, size_type offsetOther, size_type countOther = NPos)
 const 
 1414        return this->baseString.compare(offset, count, other.baseString, offsetOther, countOther);
 
 1424    int Compare(
const CharType *pOther)
 const 
 1426        return this->baseString.compare(pOther);
 
 1438    int Compare(size_type offset, size_type count, 
const CharType *pOther)
 const 
 1440        return this->baseString.compare(offset, count, pOther);
 
 1453    int Compare(size_type offset, size_type count, 
const CharType *pOther, size_type countOther)
 const 
 1455        return this->baseString.compare(offset, count, pOther, countOther);
 
 1463    bool StartWith(
const CharType *pChars)
const 
 1465        return this->Find(pChars) == 0;
 
 1471    bool StartWith(
const SelfType& pattern)
const 
 1473        return this->Find(pattern) == 0;
 
 1479    bool EndWith(
const CharType* pChars)
const 
 1481        return this->EndWith(SelfType(pChars));
 
 1487    bool EndWith(
const SelfType& pattern)
const 
 1489        size_t thisLength = this->baseString.length();
 
 1490        size_t patternLength = pattern.baseString.length();
 
 1492        if (thisLength < patternLength)
 
 1497        return (this->baseString.compare(thisLength - patternLength, patternLength, pattern.baseString) == 0);
 
 1506    template<
typename... Args>
 
 1507    static SelfType Format(
const SelfType& format, 
const Args& ... args)
 
 1509        return Format(format.CStr(), args...);
 
 1516    template<
typename... Args>
 
 1517    static SelfType Format(
const char* format, 
const Args& ... args)
 
 1519        return BasicFormatterType::FormatCommon(&BasicStringFormatExceptionHandler::Invoke, format, args...);
 
 1527    const BaseString& GetBaseString()
const 
 1529        return this->baseString;
 
 1534    const StdString& GetStdString()
const 
 1536        return this->baseString;
 
 1541    const CharType* CStr()
 const 
 1543        return this->baseString.c_str();
 
 1548    operator const CharType* () 
const 
 1550        return this->baseString.data();
 
 1555    operator const BaseString& () 
const 
 1557        return this->baseString;
 
 1564    SelfType Substr(size_type offset = 0, size_type count = NPos)
 const 
 1566        return SelfType(this->baseString.substr(offset, count));
 
 1571    Allocator GetAllocator()
 const 
 1573        return this->baseString.get_allocator();
 
 1578    void Swap(SelfType& other)
 
 1580        this->baseString.swap(other.baseString);
 
 1585    Bytes ToBytes()
const 
 1587        return Bytes(
reinterpret_cast<const byte*
>(this->CStr()), 
reinterpret_cast<const byte*
>(this->CStr() + this->Size()));
 
 1592    SelfType TrimLeft()
const 
 1594        auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
 
 1596            return !std::isspace<char>(c, std::locale::classic());
 
 1598        return SelfType(left, this->baseString.end());
 
 1601    SelfType TrimLeft(
char trim)
const 
 1603        auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [trim](
char c)
 
 1607        return SelfType(left, this->baseString.end());
 
 1610    SelfType TrimRight()
const 
 1612        auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
 
 1614            return !std::isspace<char>(c, std::locale::classic());
 
 1616        return SelfType(this->baseString.begin(), right.base());
 
 1619    SelfType TrimRight(
char trim)
const 
 1621        auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [trim](
char c)
 
 1625        return SelfType(this->baseString.begin(), right.base());
 
 1630    SelfType Trim()
const 
 1632        auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
 
 1634            return !std::isspace<char>(c, std::locale::classic());
 
 1638        if (left == this->baseString.end())
 
 1643        auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
 
 1645            return !std::isspace<char>(c, std::locale::classic());
 
 1647        return SelfType(left, right.base());
 
 1650    SelfType Trim(
char trim)
const 
 1652        auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [trim](
char c)
 
 1658        if (left == this->baseString.end())
 
 1663        auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [trim](
char c)
 
 1667        return SelfType(left, right.base());
 
 1677    Tokens Split(
char delimiter, 
bool trimTokens = 
true, 
bool removeEmptyTokens = 
true)
const 
 1679        char delimiters[] = { delimiter };
 
 1680        return this->Split(delimiters, 1, trimTokens, removeEmptyTokens);
 
 1689    Tokens Split(
const char delimiters[], 
size_t delimitersCount, 
bool trimTokens = 
true, 
bool removeEmptyTokens = 
true)
const 
 1694        size_t length = this->
Length();
 
 1696        for (
size_t first = 0; first < length; first = last + 1)
 
 1698            size_t position = this->FindFirstOf(delimiters, first, delimitersCount);
 
 1699            last = (position != NPos) ? position : this->
Length();
 
 1701            SelfType token = this->Substr(first, last - first);
 
 1704                token = token.Trim();
 
 1706            if (!removeEmptyTokens || !token.IsEmpty())
 
 1708                tokens.push_back(token);
 
 1712        if (!removeEmptyTokens && (this->FindLastOf(delimiters, NPos, delimitersCount) == (length - 1)))
 
 1714            tokens.push_back(Empty);
 
 1725    Tokens SplitByWord(
const SelfType& delimiter, 
bool trimTokens = 
true, 
bool removeEmptyTokens = 
true)
const 
 1730        size_t length = this->
Length();
 
 1731        size_t delimiterLength = delimiter.Length();
 
 1733        for (
size_t first = 0; first < length; first = last + delimiterLength)
 
 1735            size_t position = this->Find(delimiter, first);
 
 1736            last = (position != NPos) ? position : length;
 
 1738            SelfType token = this->Substr(first, last - first);
 
 1741                token = token.Trim();
 
 1743            if (!token.IsEmpty() || !removeEmptyTokens)
 
 1745                tokens.push_back(token);
 
 1749        if (!removeEmptyTokens && this->EndWith(delimiter))
 
 1751            tokens.push_back(Empty);
 
 1765    BaseString  baseString;
 
 1770template <
class CharType, 
class Alloc>
 
 1771const BasicString<CharType, Alloc> BasicString<CharType, Alloc>::Empty;
 
 1773template <
class CharType, 
class Alloc>
 
 1774const BasicString<CharType, Alloc> BasicString<CharType, Alloc>::NewLine((CharType)
'\n', (CharType)
'\r');
 
 1782template<
class CharType, 
class Alloc>
 
 1783inline void swap(BasicString<CharType, Alloc>& left, BasicString<CharType, Alloc>& right)
noexcept 
 1792template<
class CharType, 
class Alloc>
 
 1793inline std::ostream& operator<<(std::ostream& os, 
const BasicString<CharType, Alloc>& right)
 
 1795    os << right.GetStdString();
 
 1803template<
class CharType, 
class Alloc>
 
 1804inline std::istream& operator>>(std::istream& is, BasicString<CharType, Alloc>& right)
 
 1806    std::basic_string<CharType, std::char_traits<CharType>, Alloc> baseString;
 
 1808    right.Assign(baseString);
 
 1816template<
class CharType, 
class Alloc>
 
 1817inline BasicString<CharType, Alloc> operator+(
 
 1818    const BasicString<CharType, Alloc>& left,
 
 1819    const BasicString<CharType, Alloc>& right)
 
 1828template<
class CharType, 
class Alloc>
 
 1829inline BasicString<CharType, Alloc> operator+(
 
 1830    const CharType* left,
 
 1831    const BasicString<CharType, Alloc>& right)
 
 1840template<
class CharType, 
class Alloc>
 
 1841inline BasicString<CharType, Alloc> operator+(
 
 1842    const CharType left,
 
 1843    const BasicString<CharType, Alloc>& right)
 
 1852template<
class CharType, 
class Alloc>
 
 1853inline BasicString<CharType, Alloc> operator+(
 
 1854    const BasicString<CharType, Alloc>& left,
 
 1855    const CharType* right)
 
 1864template<
class CharType, 
class Alloc>
 
 1865inline BasicString<CharType, Alloc> operator+(
 
 1866    const BasicString<CharType, Alloc>& left,
 
 1867    const CharType right)
 
 1876template<
class CharType, 
class Alloc>
 
 1877inline BasicString<CharType, Alloc> operator+(
 
 1878    const BasicString<CharType, Alloc>& left,
 
 1879    BasicString<CharType, Alloc>&& right)
 
 1888template<
class CharType, 
class Alloc>
 
 1889inline BasicString<CharType, Alloc> operator+(
 
 1890    BasicString<CharType, Alloc>&& left,
 
 1891    const BasicString<CharType, Alloc>& right)
 
 1893    return (std::move(left.Append(right)));
 
 1900template<
class CharType, 
class Alloc>
 
 1901inline BasicString<CharType, Alloc> operator+(
 
 1902    BasicString<CharType, Alloc>&& left,
 
 1903    BasicString<CharType, Alloc>&& right)
 
 1912template<
class CharType, 
class Alloc>
 
 1913inline BasicString<CharType, Alloc> operator+(
 
 1914    const CharType* left,
 
 1915    BasicString<CharType, Alloc>&& right)
 
 1924template<
class CharType, 
class Alloc>
 
 1925inline BasicString<CharType, Alloc> operator+(
 
 1926    const CharType left,
 
 1927    BasicString<CharType, Alloc>&& right)
 
 1936template<
class CharType, 
class Alloc>
 
 1937inline BasicString<CharType, Alloc> operator+(
 
 1938    BasicString<CharType, Alloc>&& left,
 
 1939    const CharType* right)
 
 1948template<
class CharType, 
class Alloc>
 
 1949inline BasicString<CharType, Alloc> operator+(
 
 1950    BasicString<CharType, Alloc>&& left,
 
 1951    const CharType right)
 
 1960template<
class CharType, 
class Alloc>
 
 1961inline bool operator==(
 
 1962    const BasicString<CharType, Alloc>& left,
 
 1963    const BasicString<CharType, Alloc>& right)
 
 1965    return left.GetStdString() == right.GetStdString();
 
 1972template<
class CharType, 
class Alloc>
 
 1973inline bool operator==(
 
 1974    const CharType* left,
 
 1975    const BasicString<CharType, Alloc>& right)
 
 1977    return left == right.GetStdString();
 
 1984template<
class CharType, 
class Alloc>
 
 1985inline bool operator==(
 
 1986    const BasicString<CharType, Alloc>& left,
 
 1987    const CharType* right)
 
 1989    return left.GetStdString() == right;
 
 1996template<
class CharType, 
class Alloc>
 
 1997inline bool operator!=(
 
 1998    const CharType *left,
 
 1999    const BasicString<CharType, Alloc>& right)
 
 2001    return (!(left == right));
 
 2008template<
class CharType, 
class Alloc>
 
 2009inline bool operator!=(
 
 2010    const BasicString<CharType, Alloc>& left,
 
 2011    const CharType* right)
 
 2013    return (!(left == right));
 
 2020template<
class CharType, 
class Alloc>
 
 2021inline bool operator<(
 
 2022    const BasicString<CharType, Alloc>& left,
 
 2023    const BasicString<CharType, Alloc>& right)
 
 2025    return left.GetStdString() < right.GetStdString();
 
 2032template<
class CharType, 
class Alloc>
 
 2033inline bool operator<(
 
 2034    const CharType* left,
 
 2035    const BasicString<CharType, Alloc>& right)
 
 2037    return left < right.GetStdString();
 
 2044template<
class CharType, 
class Alloc>
 
 2045inline bool operator<(
 
 2046    const BasicString<CharType, Alloc>& left,
 
 2047    const CharType* right)
 
 2049    return left.GetStdString() < right;
 
 2056template<
class CharType, 
class Alloc>
 
 2057inline bool operator>(
 
 2058    const CharType* left,
 
 2059    const BasicString<CharType, Alloc>& right)
 
 2061    return (right < left);
 
 2068template<
class CharType, 
class Alloc>
 
 2069inline bool operator>(
 
 2070    const BasicString<CharType, Alloc>& left,
 
 2071    const CharType* right)
 
 2073    return (right < left);
 
 2080template<
class CharType, 
class Alloc>
 
 2081inline bool operator<=(
 
 2082    const CharType* left,
 
 2083    const BasicString<CharType, Alloc>& right)
 
 2085    return (!(right < left));
 
 2092template<
class CharType, 
class Alloc>
 
 2093inline bool operator<=(
 
 2094    const BasicString<CharType, Alloc>& left,
 
 2095    const CharType* right)
 
 2097    return (!(right < left));
 
 2104template<
class CharType, 
class Alloc>
 
 2105inline bool operator>=(
 
 2106    const CharType* left,
 
 2107    const BasicString<CharType, Alloc>& right)
 
 2109    return (!(left < right));
 
 2116template<
class CharType, 
class Alloc>
 
 2117inline bool operator>=(
 
 2118    const BasicString<CharType, Alloc>& left,
 
 2119    const CharType* right)
 
 2121    return (!(left < right));
 
 2129template<
class CharType, 
class Alloc>
 
 2130inline auto operator<=>(
const BasicString<CharType, Alloc>& left, 
const BasicString<CharType, Alloc>& right)
 
 2132    return left.GetStdString() <=> right.GetStdString();
 
 2139template<
class C, 
class Alloc>
 
 2140struct fmt::formatter<
Arp::BasicString<C, Alloc>> : 
public fmt::ostream_formatter {};
 
 2150template<
class C, 
class Alloc>
 
 2151struct hash<
Arp::BasicString<C, Alloc>>
 
 2154    typedef typename Arp::BasicString<C, Alloc>::BaseString    BaseString;
 
 2158    typedef Arp::BasicString<C, Alloc>  argument_type;
 
 2160    typedef size_t                      result_type;
 
 2166    result_type operator()(
const argument_type& key)
 const 
 2168        return std::hash<BaseString>()(key.GetStdString());
 
const StdString & GetStdString(void) const
Gets the std::string of this string.
Definition: String.ipp:1434
 
char8_t char8u
The Arp UTF8 character type of 1 byte size.
Definition: PrimitiveTypes.hpp:47
 
@ Empty
No sink assigned to session yet.
 
@ Append
Opens the file if it exists and seeks to the end. Otherwise, creates a new file.
 
@ Length
Specifies the size of the file in bytes as System.Int64.
 
Root namespace for the PLCnext API
 
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38
 
Namespace of the C++ standard library