diff options
author | Jesse Pavel <jpavel@src.gnome.org> | 2000-09-11 00:17:32 +0800 |
---|---|---|
committer | Jesse Pavel <jpavel@src.gnome.org> | 2000-09-11 00:17:32 +0800 |
commit | 7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5 (patch) | |
tree | cf614519e5c3a2aa973afadc84dec2f05024c386 /addressbook | |
parent | dbe32028e0dfb37adc2bfe4fa1bc27236a8e523a (diff) | |
download | gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.gz gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.zst gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.zip |
Fixed a bug regarding the extraction of the region.
svn path=/trunk/; revision=5302
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ename/e-address-western.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/addressbook/ename/e-address-western.c b/addressbook/ename/e-address-western.c index d4dcda995e..b6ced3bebf 100644 --- a/addressbook/ename/e-address-western.c +++ b/addressbook/ename/e-address-western.c @@ -13,8 +13,15 @@ #include <string.h> #include <glib.h> +#ifdef E_ADDRESS_WESTERN_TEST + +#include "e-address-western.h" + +#else + #include <ename/e-address-western.h> +#endif static gboolean e_address_western_is_line_blank (gchar *line) @@ -195,6 +202,10 @@ e_address_western_extract_locality (gchar *line) return g_strndup (line, index); } + +/* Whatever resides between the comma and the start of the + postal code is deemed to be the region. */ + gchar * e_address_western_extract_region (gchar *line) { @@ -205,10 +216,17 @@ e_address_western_extract_region (gchar *line) while (isspace(line[start])) start++; - end = start; + end = strlen(line) - 1; + while (isspace (line[end])) + end--; + while (!isspace (line[end])) - end++; - + end--; + + while (isspace (line[end])) + end--; + end++; + /* Between start and end lie the string. */ return g_strndup ( (line+start), end-start); } |