From a6ba342adec9edad3e4bcf4d614d3525b4e66186 Mon Sep 17 00:00:00 2001 From: Sébastien Le Ray Date: Thu, 17 Feb 2011 10:41:21 +0100 Subject: Added comphelper::string::decimalStringToNumber --- comphelper/inc/comphelper/string.hxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'comphelper/inc') diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx index e3c6787b2ef3..7944b1e2bddd 100644 --- a/comphelper/inc/comphelper/string.hxx +++ b/comphelper/inc/comphelper/string.hxx @@ -122,6 +122,27 @@ COMPHELPER_DLLPUBLIC ::rtl::OUString& COMPHELPER_DLLPUBLIC ::rtl::OUString convertCommaSeparated( ::com::sun::star::uno::Sequence< ::rtl::OUString > const & i_rSeq); +/** Convert a decimal string to a number. + + The string must be base-10, no sign but can contain any + codepoint listed in the "Number, Decimal Digit" Unicode + category. + + No verification is made about the validity of the string, + passing string not containing decimal digit code points + gives unspecified results + + If your string is guaranteed to contain only ASCII digit + use rtl::OUString::toInt32 instead. + + @param str The string to convert containing only decimal + digit codepoints. + + @return The value of the string as an int32. + */ +COMPHELPER_DLLPUBLIC sal_uInt32 decimalStringToNumber( + ::rtl::OUString const & str ); + /** Convert a single comma separated string to a sequence of strings. Note that no escaping of commas or anything fancy is done. -- cgit