[ox/std] Add nodiscard to some string functions
This commit is contained in:
parent
af7c89564c
commit
5eec9085f8
4
deps/ox/src/ox/std/strops.hpp
vendored
4
deps/ox/src/ox/std/strops.hpp
vendored
@ -80,6 +80,7 @@ constexpr bool endsWith(CRStringView base, CRStringView ending) noexcept {
|
|||||||
return base.len() >= endingLen && ox_strcmp(base.data() + (base.len() - endingLen), ending) == 0;
|
return base.len() >= endingLen && ox_strcmp(base.data() + (base.len() - endingLen), ending) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr std::size_t find(CRStringView str, char search) noexcept {
|
constexpr std::size_t find(CRStringView str, char search) noexcept {
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
for (; i < str.len(); ++i) {
|
for (; i < str.len(); ++i) {
|
||||||
@ -90,6 +91,7 @@ constexpr std::size_t find(CRStringView str, char search) noexcept {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr std::size_t find(CRStringView str, CRStringView search) noexcept {
|
constexpr std::size_t find(CRStringView str, CRStringView search) noexcept {
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
for (; i < str.len(); ++i) {
|
for (; i < str.len(); ++i) {
|
||||||
@ -101,6 +103,7 @@ constexpr std::size_t find(CRStringView str, CRStringView search) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t smallSz = 0>
|
template<std::size_t smallSz = 0>
|
||||||
|
[[nodiscard]]
|
||||||
constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, char del) noexcept {
|
constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, char del) noexcept {
|
||||||
ox::Vector<ox::StringView, smallSz> out;
|
ox::Vector<ox::StringView, smallSz> out;
|
||||||
constexpr auto nextSeg = [](CRStringView current, char del) {
|
constexpr auto nextSeg = [](CRStringView current, char del) {
|
||||||
@ -117,6 +120,7 @@ constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, char del)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t smallSz = 0>
|
template<std::size_t smallSz = 0>
|
||||||
|
[[nodiscard]]
|
||||||
constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, CRStringView del) noexcept {
|
constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, CRStringView del) noexcept {
|
||||||
ox::Vector<ox::StringView, smallSz> out;
|
ox::Vector<ox::StringView, smallSz> out;
|
||||||
constexpr auto nextSeg = [](CRStringView current, CRStringView del) {
|
constexpr auto nextSeg = [](CRStringView current, CRStringView del) {
|
||||||
|
Loading…
Reference in New Issue
Block a user