src/hbcore/i18n/hbstringutil.cpp
changeset 3 11d3954df52a
parent 1 f7ac710697a9
child 6 c3690ec91ef8
equal deleted inserted replaced
2:06ff229162e9 3:11d3954df52a
    40 #ifndef QT_NO_REGEXP
    40 #ifndef QT_NO_REGEXP
    41 #include <QRegExp>
    41 #include <QRegExp>
    42 #endif
    42 #endif
    43 
    43 
    44 /*!
    44 /*!
    45     @beta
    45     @stable
    46     @hbcore
    46     @hbcore
    47     \class HbStringUtil
    47     \class HbStringUtil
    48     \brief The HbStringUtil class can be used to execute operations on strings,
    48     \brief The HbStringUtil class can be used to execute operations on strings,
    49     such as comparisons and finding data sequences.
    49     such as comparisons and finding data sequences.
    50 
    50 
    51     \ingroup i18n
       
    52 
       
    53     \warning This class is only useful in Symbian platforms since it uses Symbian
       
    54     methods in order to implement different functionalities.
       
    55 
       
    56     \sa HbStringUtil
    51     \sa HbStringUtil
    57 */
    52 */
    58 
    53 
    59 /*!
    54 /*!
    60     \enum HbStringUtil::Option
    55     \enum HbStringUtil::Option
    83 */
    78 */
    84 
    79 
    85 /*!
    80 /*!
    86     Searches source string's collated data for a
    81     Searches source string's collated data for a
    87     match with collated data supplied in pattern string
    82     match with collated data supplied in pattern string
       
    83       
       
    84     \attention Cross-Platform API
    88     
    85     
    89     \param strFrom Source string.
    86     \param strFrom Source string.
    90     \param strToMatch Pattern string.
    87     \param strToMatch Pattern string.
    91     \param maxLevel Determines the tightness of the collation.
    88     \param maxLevel Determines the tightness of the collation.
    92     Level 0 - Character identity; 
    89     Level 0 - Character identity; 
    95     Level 3 - Character identity, accents, case and Unicode value; 
    92     Level 3 - Character identity, accents, case and Unicode value; 
    96     \param flags The flags that will be used. Default value is Default.
    93     \param flags The flags that will be used. Default value is Default.
    97     \param wildChar Wild card character.
    94     \param wildChar Wild card character.
    98     \param wildSequenceChar Wild card sequence character.
    95     \param wildSequenceChar Wild card sequence character.
    99     \param escapeChar The escape character, for example,  '?', '*'.
    96     \param escapeChar The escape character, for example,  '?', '*'.
       
    97     
   100     \return If a match is found the offset within source string's
    98     \return If a match is found the offset within source string's
   101     data where the match first occurs. -1 if match is not found.
    99     data where the match first occurs. -1 if match is not found.
   102     
   100     
   103     Example
   101     Example
   104     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,3}
   102     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,3}
   142 
   140 
   143 /*!
   141 /*!
   144     Compares source string's data with the other string's
   142     Compares source string's data with the other string's
   145     data using the specified collation method.
   143     data using the specified collation method.
   146     
   144     
       
   145     \attention Cross-Platform API
       
   146     
   147     \param string1 Source string.
   147     \param string1 Source string.
   148     \param string2 String whose data is to be compared with the source string.
   148     \param string2 String whose data is to be compared with the source string.
   149     \param maxLevel Maximum level to use for comparing.
   149     \param maxLevel Maximum level to use for comparing.
   150     Level 0 - Character identity; 
   150     Level 0 - Character identity; 
   151     Level 1 - Character identity and accents; 
   151     Level 1 - Character identity and accents; 
   152     Level 2 - Character identity, accents and case; 
   152     Level 2 - Character identity, accents and case; 
   153     Level 3 - Character identity, accents, case and Unicode value; 
   153     Level 3 - Character identity, accents, case and Unicode value; 
   154     \param flags The flags that will be used. Default value is Default.
   154     \param flags The flags that will be used. Default value is Default.
       
   155     
   155     \return Positive if source string is greater, negative if it is less and 
   156     \return Positive if source string is greater, negative if it is less and 
   156     zero	if the content of both strings match.
   157     zero	if the content of both strings match.
   157     
   158     
   158     Example
   159     Example
   159     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,1}
   160     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,1}
   185 
   186 
   186 /*!
   187 /*!
   187     Searches for the first occurence of the specified collated 
   188     Searches for the first occurence of the specified collated 
   188     data sequence in the aStrFrom to the specified maximum
   189     data sequence in the aStrFrom to the specified maximum
   189     collation level.
   190     collation level.
       
   191     
       
   192     \attention Cross-Platform API
   190     
   193     
   191     \param strFrom Source string.
   194     \param strFrom Source string.
   192     \param strToFind String whose data is to be compared with the source string.
   195     \param strToFind String whose data is to be compared with the source string.
   193     \param maxLevel The maximum collation level.
   196     \param maxLevel The maximum collation level.
   194     Level 0 - Character identity; 
   197     Level 0 - Character identity; 
   195     Level 1 - Character identity and accents; 
   198     Level 1 - Character identity and accents; 
   196     Level 2 - Character identity, accents and case; 
   199     Level 2 - Character identity, accents and case; 
   197     Level 3 - Character identity, accents, case and Unicode value; 
   200     Level 3 - Character identity, accents, case and Unicode value; 
       
   201     
   198     \return Offset of the data sequence from the beginning of the
   202     \return Offset of the data sequence from the beginning of the
   199     aStrFrom. -1 if the data sequence cannot be found.
   203     aStrFrom. -1 if the data sequence cannot be found.
   200     
   204     
   201     Example
   205     Example
   202     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,5}
   206     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,5}
   223 
   227 
   224 /*!
   228 /*!
   225     Searches source string's folded data for a
   229     Searches source string's folded data for a
   226     match with folded data supplied in pattern string
   230     match with folded data supplied in pattern string
   227     
   231     
       
   232     \attention Cross-Platform API
       
   233     
   228     \param strFrom Source string.
   234     \param strFrom Source string.
   229     \param strToMatch Pattern string.
   235     \param strToMatch Pattern string.
       
   236     
   230     \return If a match is found the offset within source string's
   237     \return If a match is found the offset within source string's
   231     data where the match first occurs. -1 if match is not found.
   238     data where the match first occurs. -1 if match is not found.
   232     
   239     
   233     Example
   240     Example
   234     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,4}
   241     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,4}
   255 
   262 
   256 /*!
   263 /*!
   257     Searches for the first occurence of the specified folded 
   264     Searches for the first occurence of the specified folded 
   258     data sequence in the strFrom.
   265     data sequence in the strFrom.
   259     
   266     
       
   267     \attention Cross-Platform API
       
   268     
   260     \param strFrom Source string.
   269     \param strFrom Source string.
   261     \param strToFind String whose data is to be compared with the source string.
   270     \param strToFind String whose data is to be compared with the source string.
       
   271     
   262     \return Offset of the data sequence from the beginning of the
   272     \return Offset of the data sequence from the beginning of the
   263     strFrom. -1 if the data sequence cannot be found. Zero,
   273     strFrom. -1 if the data sequence cannot be found. Zero,
   264     if the length of search data sequence is zero.
   274     if the length of search data sequence is zero.
   265     
   275     
   266     Example
   276     Example
   281 
   291 
   282 /*!
   292 /*!
   283     Compares source string's folded data with the other string's
   293     Compares source string's folded data with the other string's
   284     folded data.
   294     folded data.
   285     
   295     
       
   296     \attention Cross-Platform API
       
   297     
   286     \param string1 Source string.
   298     \param string1 Source string.
   287     \param string2 String whose data is to be compared with the source string.
   299     \param string2 String whose data is to be compared with the source string.
       
   300     
   288     \return Positive if source string is greater, negative if it is less and 
   301     \return Positive if source string is greater, negative if it is less and 
   289     zero if the content of both strings match.
   302     zero if the content of both strings match.
   290     
   303     
   291     Example
   304     Example
   292     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,2}
   305     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,2}
   321     return ch;
   334     return ch;
   322 }
   335 }
   323 
   336 
   324 /*!
   337 /*!
   325     Converts digits to native digits based on current UI language.
   338     Converts digits to native digits based on current UI language.
       
   339     
       
   340     \attention Cross-Platform API
       
   341     
   326     \param str digits to be converted.
   342     \param str digits to be converted.
   327  */
   343  */
   328 QString HbStringUtil::convertDigits( const QString str ) 
   344 QString HbStringUtil::convertDigits( const QString str ) 
   329 {
   345 {
   330 	HbExtendedLocale locale = HbExtendedLocale::system();
   346 	HbExtendedLocale locale = HbExtendedLocale::system();
   342 	return converted;
   358 	return converted;
   343 }
   359 }
   344 
   360 
   345 /*!
   361 /*!
   346     Converts the digit from Latin to native or native to latin or native to native
   362     Converts the digit from Latin to native or native to latin or native to native
       
   363     
       
   364     \attention Cross-Platform API
       
   365     
   347     \param str digits to be converted.
   366     \param str digits to be converted.
   348     \param digitType type of the digit to be converted to
   367     \param digitType type of the digit to be converted to
   349  */
   368  */
   350 QString HbStringUtil::convertDigitsTo( const QString str, const DigitType digitType ) 
   369 QString HbStringUtil::convertDigitsTo( const QString str, const DigitType digitType ) 
   351 {
   370 {
   375 }
   394 }
   376 
   395 
   377 /*!
   396 /*!
   378     Sorts QStrings into alphabetically order (overwrites the strList's original content)
   397     Sorts QStrings into alphabetically order (overwrites the strList's original content)
   379     
   398     
       
   399     \attention Cross-Platform API
       
   400     
   380     \param strList List of QStrings which need to be sorted.
   401     \param strList List of QStrings which need to be sorted.
   381     
   402     
   382     Example
   403     Example
   383     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,7}
   404     \snippet{unittest_hbstringutil/unittest_hbstringutil.cpp,7}
   384  */
   405  */