From: Kevin Day Date: Sun, 12 Jul 2020 21:16:38 +0000 (-0500) Subject: Update: add missing string compare functions. X-Git-Tag: 0.5.0~91 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=ac6a5beba4ae7a5a9cf1caee32a1070bf216aa31;p=fll Update: add missing string compare functions. These should have been implemented for completeness but were not. --- diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index bd855c9..6aff439 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -220,12 +220,24 @@ extern "C" { } #endif // _di_fl_string_dynamic_compare_ +#ifndef _di_fl_string_dynamic_compare_string_ + f_return_status fl_string_dynamic_compare_string(const f_string string1, const f_string_static string2, const f_string_length length1) { + return private_fl_string_compare(string1, string2.string, 0, 0, length1, string2.used); + } +#endif // _di_fl_string_dynamic_compare_string_ + #ifndef _di_fl_string_dynamic_compare_trim_ f_return_status fl_string_dynamic_compare_trim(const f_string_static string1, const f_string_static string2) { return private_fl_string_compare_trim(string1.string, string2.string, 0, 0, string1.used, string2.used); } #endif // _di_fl_string_dynamic_compare_trim_ +#ifndef _di_fl_string_dynamic_compare_trim_string_ + f_return_status fl_string_dynamic_compare_trim_string(const f_string string1, const f_string_static string2, const f_string_length length1) { + return private_fl_string_compare_trim(string1, string2.string, 0, 0, length1, string2.used); + } +#endif // _di_fl_string_dynamic_compare_trim_string_ + #ifndef _di_fl_string_dynamic_mash_ f_return_status fl_string_dynamic_mash(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 9d2909a..904d973 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -289,6 +289,35 @@ extern "C" { /** * Compare two strings, similar to strncmp(). * + * This operates with the first string being a traditional string. + * + * This does not stop on NULL. + * NULL characters are ignored. + * Ignores leading and trailing whitespace. + * + * @param string1 + * String to compare. + * @param string2 + * String to compare. + * @param length1 + * The length of string1. + * + * @return + * F_equal_to when both strings equal. + * F_equal_to_not when both strings do not equal. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() + */ +#ifndef _di_fl_string_dynamic_compare_string_ + extern f_return_status fl_string_dynamic_compare_string(const f_string string1, const f_string_static string2, const f_string_length length1); +#endif // _di_fl_string_dynamic_compare_string_ + +/** + * Compare two strings, similar to strncmp(). + * * This does not stop on NULL. * NULL characters are ignored. * Ignores leading and trailing whitespace. @@ -312,6 +341,35 @@ extern "C" { #endif // _di_fl_string_dynamic_compare_trim_ /** + * Compare two strings, similar to strncmp(). + * + * This operates with the first string being a traditional string. + * + * This does not stop on NULL. + * NULL characters are ignored. + * Ignores leading and trailing whitespace. + * + * @param string1 + * String to compare. + * @param string2 + * String to compare. + * @param length1 + * The length of string1. + * + * @return + * F_equal_to when both strings equal. + * F_equal_to_not when both strings do not equal. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() + */ +#ifndef _di_fl_string_dynamic_compare_trim_string_ + extern f_return_status fl_string_dynamic_compare_trim_string(const f_string string1, const f_string_static string2, const f_string_length length1); +#endif // _di_fl_string_dynamic_compare_trim_string_ + +/** * Append the source string onto the destination with the glue in between. * * If the destination string is empty, then no glue is appended.