admin
2023-03-07 8b06b1cbf112d55307ea8a6efe711db4e7506d89
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "pch.h"
#include "StringUtils.h"
 
 
  std::string StringUtils::trim(const std::string source, const std::string chars) {
    std::string other(source);
    auto start = other.find_first_of(chars);
    auto end = other.find_first_not_of(chars, start);
    while (start > -1) {
        other.erase(start, end - start);
        start = other.find_first_of(chars);
        end = other.find_first_not_of(chars, start);
    }
    return other;
}
 
 
  std::string StringUtils::trim(const std::string source) {
    return trim(source, " \t\n\r");
}