summaryrefslogtreecommitdiff
path: root/string_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'string_utils.c')
-rw-r--r--string_utils.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/string_utils.c b/string_utils.c
index e28ccfc..db077a7 100644
--- a/string_utils.c
+++ b/string_utils.c
@@ -1,48 +1,48 @@
-/* START LIBRARY DESCRIPTION *********************************************
-FLOAT.LIB
- Copyright (c) 2006, Avtech Electrosystems Ltd.
-
-DESCRIPTION:
- Functions that deal with strings and floating point numbers.
-
-SUPPORT LIB'S:
-END DESCRIPTION **********************************************************/
-
-
-#include <string.h>
-#include <ctype.h>
-#include <math.h>
-#include <glib/gprintf.h>
-#include "globals.h"
-#include "string_utils.h"
-
-void Float_To_Text(int decimal_digits,float number_in, gchar ** text_out)
-{
- g_assert (*text_out == NULL);
-
- if (fabs(number_in)<1.1*smallest_allowed_number) {
- if (number_in<0.0) {
- *text_out = g_strdup_printf("-0.%0*d",decimal_digits,0);
- } else {
- *text_out = g_strdup_printf("0.%0*d",decimal_digits,0);
- }
- return;
- }
-
- *text_out = g_strdup_printf("%.*e", decimal_digits, number_in);
-}
-
-
-/*----------------------------------------------------------------------------------------------------------*/
-gboolean String_is_it_numeric(char *parameter)
-{
-
- GRegex *numeric_regex = g_regex_new ( "\\s*[+-]?(\\d*\\.\\d+|\\d+(\\.\\d*)?)\\s*(e\\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;
-}
+/* START LIBRARY DESCRIPTION *********************************************
+FLOAT.LIB
+ Copyright (c) 2006, Avtech Electrosystems Ltd.
+
+DESCRIPTION:
+ Functions that deal with strings and floating point numbers.
+
+SUPPORT LIB'S:
+END DESCRIPTION **********************************************************/
+
+
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <glib/gprintf.h>
+#include "globals.h"
+#include "string_utils.h"
+
+void Float_To_Text(int decimal_digits,float number_in, gchar ** text_out)
+{
+ g_assert (*text_out == NULL);
+
+ if (fabs(number_in)<1.1*smallest_allowed_number) {
+ if (number_in<0.0) {
+ *text_out = g_strdup_printf("-0.%0*d",decimal_digits,0);
+ } else {
+ *text_out = g_strdup_printf("0.%0*d",decimal_digits,0);
+ }
+ return;
+ }
+
+ *text_out = g_strdup_printf("%.*e", decimal_digits, number_in);
+}
+
+
+/*----------------------------------------------------------------------------------------------------------*/
+gboolean String_is_it_numeric(char *parameter)
+{
+
+ GRegex *numeric_regex = g_regex_new ( "\\s*[+-]?(\\d*\\.\\d+|\\d+(\\.\\d*)?)\\s*(e\\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;
+}