LCOV - code coverage report
Current view: top level - intl/icu/source/common - unistr_props.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // © 2016 and later: Unicode, Inc. and others.
       2             : // License & terms of use: http://www.unicode.org/copyright.html
       3             : /*
       4             : *******************************************************************************
       5             : *
       6             : *   Copyright (C) 1999-2011, International Business Machines
       7             : *   Corporation and others.  All Rights Reserved.
       8             : *
       9             : *******************************************************************************
      10             : *   file name:  unistr_props.cpp
      11             : *   encoding:   UTF-8
      12             : *   tab size:   8 (not used)
      13             : *   indentation:2
      14             : *
      15             : *   created on: 2004aug25
      16             : *   created by: Markus W. Scherer
      17             : *
      18             : *   Character property dependent functions moved here from unistr.cpp
      19             : */
      20             : 
      21             : #include "unicode/utypes.h"
      22             : #include "unicode/uchar.h"
      23             : #include "unicode/unistr.h"
      24             : #include "unicode/utf16.h"
      25             : 
      26             : U_NAMESPACE_BEGIN
      27             : 
      28             : UnicodeString& 
      29           0 : UnicodeString::trim()
      30             : {
      31           0 :   if(isBogus()) {
      32           0 :     return *this;
      33             :   }
      34             : 
      35           0 :   UChar *array = getArrayStart();
      36             :   UChar32 c;
      37           0 :   int32_t oldLength = this->length();
      38           0 :   int32_t i = oldLength, length;
      39             : 
      40             :   // first cut off trailing white space
      41             :   for(;;) {
      42           0 :     length = i;
      43           0 :     if(i <= 0) {
      44           0 :       break;
      45             :     }
      46           0 :     U16_PREV(array, 0, i, c);
      47           0 :     if(!(c == 0x20 || u_isWhitespace(c))) {
      48           0 :       break;
      49             :     }
      50           0 :   }
      51           0 :   if(length < oldLength) {
      52           0 :     setLength(length);
      53             :   }
      54             : 
      55             :   // find leading white space
      56             :   int32_t start;
      57           0 :   i = 0;
      58             :   for(;;) {
      59           0 :     start = i;
      60           0 :     if(i >= length) {
      61           0 :       break;
      62             :     }
      63           0 :     U16_NEXT(array, i, length, c);
      64           0 :     if(!(c == 0x20 || u_isWhitespace(c))) {
      65           0 :       break;
      66             :     }
      67           0 :   }
      68             : 
      69             :   // move string forward over leading white space
      70           0 :   if(start > 0) {
      71           0 :     doReplace(0, start, 0, 0, 0);
      72             :   }
      73             : 
      74           0 :   return *this;
      75             : }
      76             : 
      77             : U_NAMESPACE_END

Generated by: LCOV version 1.13