summaryrefslogtreecommitdiff
path: root/string_utils.c
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:53:17 +0900
committerroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:53:17 +0900
commitb3b9289e331287a6869fd4a91df62c479f30508c (patch)
treece9d3036bbc449d3bcd182e74dd5b5ada2acd75c /string_utils.c
parenteb0f47ea5e8367c6462d0dbe904afc495e04af4b (diff)
stronger checking of numeric parameter formats
Diffstat (limited to 'string_utils.c')
-rw-r--r--string_utils.c28
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)
{