aboutsummaryrefslogtreecommitdiff
path: root/src/common/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/string.c')
-rw-r--r--src/common/string.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/string.c b/src/common/string.c
index bcbbfb813db..3e76e2c59fb 100644
--- a/src/common/string.c
+++ b/src/common/string.c
@@ -93,6 +93,22 @@ pg_clean_ascii(char *str)
/*
+ * pg_is_ascii -- Check if string is made only of ASCII characters
+ */
+bool
+pg_is_ascii(const char *str)
+{
+ while (*str)
+ {
+ if (IS_HIGHBIT_SET(*str))
+ return false;
+ str++;
+ }
+ return true;
+}
+
+
+/*
* pg_strip_crlf -- Remove any trailing newline and carriage return
*
* Removes any trailing newline and carriage return characters (\r on