diff options
author | pixel <pixel> | 2007-04-01 11:39:06 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-04-01 11:39:06 +0000 |
commit | dcb4548df2ea63e0736255c1b4e840678c2dddac (patch) | |
tree | 74b73497a74f43f66c48e3d6f129e5aed6a23cd0 | |
parent | 2b123922d8804ccc99d8e4ae119a230d36faefb7 (diff) |
Having a "format" to the "to_int" method.
-rw-r--r-- | include/BString.h | 4 | ||||
-rw-r--r-- | lib/String.cc | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/include/BString.h b/include/BString.h index 2caebb3..0d084ad 100644 --- a/include/BString.h +++ b/include/BString.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BString.h,v 1.14 2006-02-09 17:03:07 pixel Exp $ */ +/* $Id: BString.h,v 1.15 2007-04-01 11:39:06 pixel Exp $ */ #ifndef __STRING_H__ #define __STRING_H__ @@ -52,7 +52,7 @@ class String : public Base { const char * to_charp(size_t = 0, ssize_t = -1) const throw (GeneralException); String extract(size_t = 0, ssize_t = -1) const; char * strdup(size_t = 0, ssize_t = -1) const; - int to_int() const; + int to_int(const char * fmt = "%i") const; double to_double() const; String to_sqldate() const; String to_sqltime() const; diff --git a/lib/String.cc b/lib/String.cc index 57fcdc3..b7ce2ab 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: String.cc,v 1.45 2006-07-17 16:08:44 pixel Exp $ */ +/* $Id: String.cc,v 1.46 2007-04-01 11:39:06 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -278,10 +278,10 @@ char * String::strdup(size_t from, ssize_t to) const { return r; } -int String::to_int(void) const { +int String::to_int(const char * fmt) const { int r; - sscanf(str, "%i", &r); + sscanf(str, fmt, &r); return r; } |