diff options
Diffstat (limited to 'string_utils.c')
-rw-r--r-- | string_utils.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/string_utils.c b/string_utils.c index 3087060..264a6bd 100644 --- a/string_utils.c +++ b/string_utils.c @@ -37,6 +37,34 @@ gboolean String_is_it_numeric(char *parameter) } +gboolean String_is_it_pos_int(char *parameter) +{ + + GRegex *numeric_regex = g_regex_new ( "^\\s*[+]?\\d+\\s*$", + G_REGEX_CASELESS, + 0, + NULL); + + gboolean match = g_regex_match (numeric_regex, parameter, 0, NULL); + g_regex_unref (numeric_regex); + return match; +} + + +gboolean String_is_it_pos_neg_int(char *parameter) +{ + + GRegex *numeric_regex = g_regex_new ( "^\\s*[+-]?\\d+\\s*$", + G_REGEX_CASELESS, + 0, + NULL); + + gboolean match = g_regex_match (numeric_regex, parameter, 0, NULL); + g_regex_unref (numeric_regex); + return match; +} + + void String_Parameter_To_Text(float Float_To_Convert, int significant_digits, char *start_string,char *units,gchar **LCD_string,int show_plus_sign, int width_of_column) { |