gfxconversion/mifconv/src/mifconv_util.cpp
branchRCL_3
changeset 11 e5e3f539dd55
parent 2 1f6339ced17d
equal deleted inserted replaced
4:d3300267661e 11:e5e3f539dd55
    26 #else
    26 #else
    27     #include <unistd.h>
    27     #include <unistd.h>
    28 #endif
    28 #endif
    29 #include <stdlib.h>     // for _MAX_PATH
    29 #include <stdlib.h>     // for _MAX_PATH
    30 #include <stdio.h>
    30 #include <stdio.h>
       
    31 #include <cctype>
    31 
    32 
    32 #ifndef _MAX_PATH
    33 #ifndef _MAX_PATH
    33 #define _MAX_PATH   (260)
    34 #define _MAX_PATH   (260)
    34 #endif
    35 #endif
    35 
    36 
   183     {        
   184     {        
   184         MifConvString::size_type index = 0;
   185         MifConvString::size_type index = 0;
   185         while( (index = str.find(replaceFrom, index)) != MifConvString::npos )
   186         while( (index = str.find(replaceFrom, index)) != MifConvString::npos )
   186         {     
   187         {     
   187             str.replace(index,1,1,replaceTo);
   188             str.replace(index,1,1,replaceTo);
       
   189         }
       
   190     }
       
   191 }
       
   192 
       
   193 /**
       
   194  *
       
   195  */
       
   196 void MifConvUtil::ReplaceStr( MifConvString& str, 
       
   197                               MifConvString replaceFrom, MifConvString replaceTo)
       
   198 {
       
   199     if( str.length() >= replaceFrom.length() )
       
   200     {        
       
   201         MifConvString::size_type index = 0;
       
   202         while( (index = str.find(replaceFrom, index)) != MifConvString::npos )
       
   203         {     
       
   204             MifConvString tmp_str = str.substr(0, index);
       
   205             tmp_str = tmp_str + replaceTo;
       
   206             str = tmp_str + str.substr(index+replaceFrom.length(),
       
   207                                            str.length()-index+replaceFrom.length()
       
   208                                            );
   188         }
   209         }
   189     }
   210     }
   190 }
   211 }
   191 
   212 
   192 /**
   213 /**