diff --git a/main.cpp b/main.cpp index 72b68683..691cecdb 100644 --- a/main.cpp +++ b/main.cpp @@ -31,7 +31,7 @@ public: int main (int argc, char * argv[]) { VC<30, double> x(1.5), y(3.3); - double r; + double r = 0.0; PITimeMeasurer tm; for (int i=0; i<10000; i++) r = x.dot(y); diff --git a/src/core/pistring.cpp b/src/core/pistring.cpp index cab4de47..5b507deb 100755 --- a/src/core/pistring.cpp +++ b/src/core/pistring.cpp @@ -271,6 +271,16 @@ const char * PIString::dataAscii() const { } +PIByteArray PIString::toUTF8() const { + buildData( +#ifdef PIP_ICU + "UTF-8" +#endif + ); + return data_.resized(data_.size_s() - 1); +} + + PIString & PIString::operator +=(const char * str) { int l = 0; while (str[l] != '\0') ++l; diff --git a/src/core/pistring.h b/src/core/pistring.h index 8e7019fe..0b6735b3 100755 --- a/src/core/pistring.h +++ b/src/core/pistring.h @@ -502,6 +502,9 @@ public: //! \brief Return \a PIByteArray contains \a data() of this string without terminating null-char PIByteArray toByteArray() const {buildData(); return data_.resized(data_.size_s() - 1);} + //! \brief Return \a PIByteArray contains UTF-8 \a data() of this string without terminating null-char + PIByteArray toUTF8() const; + /*! \brief Split string with delimiter "delim" to \a PIStringList and return it * \details Example: \snippet pistring.cpp PIString::split */ PIStringList split(const PIString & delim) const;