Skip to content

Commit

Permalink
rename sub_string in substring
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Oct 27, 2024
1 parent e0a4ee7 commit c15e191
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
14 changes: 7 additions & 7 deletions src/xtd.core.native.linux/include/xtd/native/linux/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ namespace xtd::native::linux {
if (count == 1) return {str};

auto list = std::vector<std::string> {};
auto sub_string = std::string {};
auto substring = std::string {};
auto split_char_separators = separators.size() == 0 ? std::vector<char> {9, 10, 11, 12, 13, 32} : separators;
for (auto it = str.begin(); it != str.end(); ++it) {
auto is_separator = std::find(split_char_separators.begin(), split_char_separators.end(), *it) != split_char_separators.end();
if (!is_separator) sub_string.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (sub_string.length() > 0 || (sub_string.length() == 0 && !remove_empty_entries))) {
if (!is_separator) substring.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (substring.length() > 0 || (substring.length() == 0 && !remove_empty_entries))) {
if (list.size() == count - 1) {
list.push_back(sub_string + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
list.push_back(substring + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
return list;
}
list.push_back(sub_string);
sub_string.clear();
list.push_back(substring);
substring.clear();
}
}

return list;
}

static std::string sub_string(const std::string& str, size_t start_index, size_t length) noexcept {
static std::string substring(const std::string& str, size_t start_index, size_t length) noexcept {
if (start_index >= str.size()) return "";
return str.substr(start_index, length);
}
Expand Down
14 changes: 7 additions & 7 deletions src/xtd.core.native.macos/include/xtd/native/macos/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,25 @@ namespace xtd::native::macos {
if (count == 1) return {str};

auto list = std::vector<std::string> {};
auto sub_string = std::string {};
auto substring = std::string {};
auto split_char_separators = separators.size() == 0 ? std::vector<char> {9, 10, 11, 12, 13, 32} : separators;
for (auto it = str.begin(); it != str.end(); ++it) {
auto is_separator = std::find(split_char_separators.begin(), split_char_separators.end(), *it) != split_char_separators.end();
if (!is_separator) sub_string.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (sub_string.length() > 0 || (sub_string.length() == 0 && !remove_empty_entries))) {
if (!is_separator) substring.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (substring.length() > 0 || (substring.length() == 0 && !remove_empty_entries))) {
if (list.size() == count - 1) {
list.push_back(sub_string + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
list.push_back(substring + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
return list;
}
list.push_back(sub_string);
sub_string.clear();
list.push_back(substring);
substring.clear();
}
}

return list;
}

static std::string sub_string(const std::string& str, size_t start_index, size_t length) noexcept {
static std::string substring(const std::string& str, size_t start_index, size_t length) noexcept {
if (start_index >= str.size()) return "";
return str.substr(start_index, length);
}
Expand Down
14 changes: 7 additions & 7 deletions src/xtd.core.native.posix/include/xtd/native/posix/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ namespace xtd::native::posix {
if (count == 1) return {str};

auto list = std::vector<std::string> {};
auto sub_string = std::string {};
auto substring = std::string {};
auto split_char_separators = separators.size() == 0 ? std::vector<char> {9, 10, 11, 12, 13, 32} : separators;
for (auto it = str.begin(); it != str.end(); ++it) {
auto is_separator = std::find(split_char_separators.begin(), split_char_separators.end(), *it) != split_char_separators.end();
if (!is_separator) sub_string.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (sub_string.length() > 0 || (sub_string.length() == 0 && !remove_empty_entries))) {
if (!is_separator) substring.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (substring.length() > 0 || (substring.length() == 0 && !remove_empty_entries))) {
if (list.size() == count - 1) {
list.push_back(sub_string + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
list.push_back(substring + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
return list;
}
list.push_back(sub_string);
sub_string.clear();
list.push_back(substring);
substring.clear();
}
}

return list;
}

static std::string sub_string(const std::string& str, size_t start_index, size_t length) noexcept {
static std::string substring(const std::string& str, size_t start_index, size_t length) noexcept {
if (start_index >= str.size()) return "";
return str.substr(start_index, length);
}
Expand Down
14 changes: 7 additions & 7 deletions src/xtd.core.native.unix/include/xtd/native/unix/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ namespace xtd::native::unix {
if (count == 1) return {str};

auto list = std::vector<std::string> {};
auto sub_string = std::string {};
auto substring = std::string {};
auto split_char_separators = separators.size() == 0 ? std::vector<char> {9, 10, 11, 12, 13, 32} : separators;
for (auto it = str.begin(); it != str.end(); ++it) {
auto is_separator = std::find(split_char_separators.begin(), split_char_separators.end(), *it) != split_char_separators.end();
if (!is_separator) sub_string.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (sub_string.length() > 0 || (sub_string.length() == 0 && !remove_empty_entries))) {
if (!is_separator) substring.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (substring.length() > 0 || (substring.length() == 0 && !remove_empty_entries))) {
if (list.size() == count - 1) {
list.push_back(sub_string + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
list.push_back(substring + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
return list;
}
list.push_back(sub_string);
sub_string.clear();
list.push_back(substring);
substring.clear();
}
}

return list;
}

static std::string sub_string(const std::string& str, size_t start_index, size_t length) noexcept {
static std::string substring(const std::string& str, size_t start_index, size_t length) noexcept {
if (start_index >= str.size()) return "";
return str.substr(start_index, length);
}
Expand Down
14 changes: 7 additions & 7 deletions src/xtd.core.native.win32/include/xtd/native/win32/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@ namespace xtd::native {
if (count == 1) return {str};

auto list = std::vector<std::string> {};
auto sub_string = std::string {};
auto substring = std::string {};
auto split_char_separators = separators.size() == 0 ? std::vector<char> {9, 10, 11, 12, 13, 32} : separators;
for (auto it = str.begin(); it != str.end(); ++it) {
auto is_separator = std::find(split_char_separators.begin(), split_char_separators.end(), *it) != split_char_separators.end();
if (!is_separator) sub_string.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (sub_string.length() > 0 || (sub_string.length() == 0 && !remove_empty_entries))) {
if (!is_separator) substring.append(std::string(1, *it));
if ((static_cast<size_t>(it - str.begin()) == str.length() - 1 || is_separator) && (substring.length() > 0 || (substring.length() == 0 && !remove_empty_entries))) {
if (list.size() == count - 1) {
list.push_back(sub_string + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
list.push_back(substring + std::string(str.c_str(), it - str.begin() + (is_separator ? 0 : 1), str.length() - (it - str.begin()) + (is_separator ? 0 : 1)));
return list;
}
list.push_back(sub_string);
sub_string.clear();
list.push_back(substring);
substring.clear();
}
}

return list;
}

static std::string sub_string(const std::string& str, size_t start_index, size_t length) noexcept {
static std::string substring(const std::string& str, size_t start_index, size_t length) noexcept {
if (start_index >= str.size()) return "";
return str.substr(start_index, length);
}
Expand Down

0 comments on commit c15e191

Please sign in to comment.