admin
2022-10-28 086ec74e94654e92b3a1c6f42612d12ef33ff4b2
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");
}