Files
core_zero/tjp/core/string/cmp.cpp
Timothy Prepscius 996151a56a flatten 20260225
2026-02-25 12:43:06 -05:00

51 lines
962 B
C++
Executable File

// License: Modified MIT (NON-AI)
// See the LICENSE file in the root directory for license information.
// Copyright 2025 Timothy Prepscius
#ifdef TJP_CORE_HEADER_ONLY
#pragma once
#endif
#include "../header_only/compile.h"
#include "cmp.hpp"
#include "strncmp.h"
namespace tjp::core {
TJP_CORE_HEADER_ONLY_INLINE
int cmp(const String &l, const String &r)
{
return strncmp(l.c_str(), l.size(), r.c_str(), r.size());
}
TJP_CORE_HEADER_ONLY_INLINE
bool less(const String &l, const String &r)
{
return l < r;
}
TJP_CORE_HEADER_ONLY_INLINE
bool equal(const String &l, String &r)
{
return l == r;
}
TJP_CORE_HEADER_ONLY_INLINE
int cmp(const StringView &l, const StringView &r)
{
return strncmp(l.data(), l.size(), r.data(), r.size());
}
TJP_CORE_HEADER_ONLY_INLINE
bool less(const StringView &l, const StringView &r)
{
return l < r;
}
TJP_CORE_HEADER_ONLY_INLINE
bool equal(const StringView &l, const StringView &r)
{
return l == r;
}
} // namespace