Bump version to 24.04.3.4
[LibreOffice.git] / sal / rtl / string.cxx
blob95f51ad288d0948941c6106546d50a0fb4d10e14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <cassert>
23 #include <cstdlib>
25 #include <osl/diagnose.h>
26 #include <rtl/tencinfo.h>
28 #include "strimp.hxx"
29 #include <rtl/character.hxx>
30 #include <rtl/string.h>
32 #include <rtl/math.h>
34 #if defined _WIN32
35 // Temporary check to verify that the #pragma pack around rtl_String is indeed cargo cult and can
36 // safely be removed:
37 static_assert(alignof (rtl_String) == 4);
38 static_assert(sizeof (rtl_String) == 12);
39 #endif
41 /* ======================================================================= */
43 #if USE_SDT_PROBES
44 #define RTL_LOG_STRING_BITS 8
45 #endif
47 #include "strtmpl.hxx"
49 /* ======================================================================= */
51 sal_Int32 SAL_CALL rtl_str_valueOfFloat(char * pStr, float f)
52 SAL_THROW_EXTERN_C()
54 return rtl::str::valueOfFP<RTL_STR_MAX_VALUEOFFLOAT>(pStr, f);
57 sal_Int32 SAL_CALL rtl_str_valueOfDouble(char * pStr, double d)
58 SAL_THROW_EXTERN_C()
60 return rtl::str::valueOfFP<RTL_STR_MAX_VALUEOFDOUBLE>(pStr, d);
63 float SAL_CALL rtl_str_toFloat(char const * pStr) SAL_THROW_EXTERN_C()
65 assert(pStr);
66 return static_cast<float>(rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
67 '.', 0, nullptr, nullptr));
70 double SAL_CALL rtl_str_toDouble(char const * pStr) SAL_THROW_EXTERN_C()
72 assert(pStr);
73 return rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr), '.', 0,
74 nullptr, nullptr);
77 /* ======================================================================= */
79 static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
81 int n;
82 sal_Unicode c;
83 sal_uInt32 nUCS4Char;
84 const sal_Unicode* pEndStr;
86 n = 0;
87 pEndStr = pStr+nLen;
88 while ( pStr < pEndStr )
90 c = *pStr;
92 if ( c < 0x80 )
93 n++;
94 else if ( c < 0x800 )
95 n += 2;
96 else
98 if ( !rtl::isHighSurrogate(c) )
99 n += 3;
100 else
102 nUCS4Char = c;
104 if ( pStr+1 < pEndStr )
106 c = *(pStr+1);
107 if ( rtl::isLowSurrogate(c) )
109 nUCS4Char = rtl::combineSurrogates(nUCS4Char, c);
110 pStr++;
114 if ( nUCS4Char < 0x10000 )
115 n += 3;
116 else if ( nUCS4Char < 0x200000 )
117 n += 4;
118 else if ( nUCS4Char < 0x4000000 )
119 n += 5;
120 else
121 n += 6;
125 pStr++;
128 return n;
131 /* ----------------------------------------------------------------------- */
133 static bool rtl_impl_convertUStringToString(rtl_String ** pTarget,
134 sal_Unicode const * pSource,
135 sal_Int32 nLength,
136 rtl_TextEncoding nEncoding,
137 sal_uInt32 nFlags,
138 bool bCheckErrors)
140 assert(pTarget != nullptr);
141 assert(pSource != nullptr || nLength == 0);
142 assert(nLength >= 0);
143 OSL_ASSERT(nLength == 0 || rtl_isOctetTextEncoding(nEncoding));
145 if ( !nLength )
146 rtl_string_new( pTarget );
147 else
149 rtl_String* pTemp;
150 rtl_UnicodeToTextConverter hConverter;
151 sal_uInt32 nInfo;
152 sal_Size nSrcChars;
153 sal_Size nDestBytes;
154 sal_Size nNewLen;
155 sal_Size nNotConvertedChars;
156 sal_Size nMaxCharLen;
158 /* Optimization for UTF-8 - we try to calculate the exact length */
159 /* For all other encoding we try a good estimation */
160 if ( nEncoding == RTL_TEXTENCODING_UTF8 )
162 nNewLen = rtl_ImplGetFastUTF8ByteLen( pSource, nLength );
163 /* Includes the string only ASCII, then we could copy
164 the buffer faster */
165 if ( nNewLen == static_cast<sal_Size>(nLength) )
167 char* pBuffer;
168 if ( *pTarget )
169 rtl_string_release( *pTarget );
170 *pTarget = rtl_string_ImplAlloc( nLength );
171 OSL_ASSERT(*pTarget != nullptr);
172 pBuffer = (*pTarget)->buffer;
175 /* Check ASCII range */
176 OSL_ENSURE( *pSource <= 127,
177 "rtl_uString2String() - UTF8 test is encoding is wrong" );
179 *pBuffer = static_cast<char>(static_cast<unsigned char>(*pSource));
180 pBuffer++;
181 pSource++;
182 nLength--;
184 while ( nLength );
185 return true;
188 nMaxCharLen = 4;
190 else
192 rtl_TextEncodingInfo aTextEncInfo;
193 aTextEncInfo.StructSize = sizeof( aTextEncInfo );
194 if ( !rtl_getTextEncodingInfo( nEncoding, &aTextEncInfo ) )
196 aTextEncInfo.AverageCharSize = 1;
197 aTextEncInfo.MaximumCharSize = 8;
200 nNewLen = nLength * static_cast<sal_Size>(aTextEncInfo.AverageCharSize);
201 nMaxCharLen = aTextEncInfo.MaximumCharSize;
204 nFlags |= RTL_UNICODETOTEXT_FLAGS_FLUSH;
205 hConverter = rtl_createUnicodeToTextConverter( nEncoding );
207 for (;;)
209 pTemp = rtl_string_ImplAlloc( nNewLen );
210 OSL_ASSERT(pTemp != nullptr);
211 nDestBytes = rtl_convertUnicodeToText( hConverter, nullptr,
212 pSource, nLength,
213 pTemp->buffer, nNewLen,
214 nFlags,
215 &nInfo, &nSrcChars );
216 if (bCheckErrors && (nInfo & RTL_UNICODETOTEXT_INFO_ERROR) != 0)
218 rtl_freeString(pTemp);
219 rtl_destroyUnicodeToTextConverter(hConverter);
220 return false;
223 if ((nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) == 0)
224 break;
226 /* Buffer not big enough, try again with enough space */
227 rtl_freeString( pTemp );
229 /* Try with the max. count of characters with
230 additional overhead for replacing functionality */
231 nNotConvertedChars = nLength-nSrcChars;
232 nNewLen = nDestBytes+(nNotConvertedChars*nMaxCharLen)+nNotConvertedChars+4;
235 /* Set the buffer to the correct size or is there to
236 much overhead, reallocate to the correct size */
237 if ( nNewLen > nDestBytes+8 )
239 rtl_String* pTemp2 = rtl_string_ImplAlloc( nDestBytes );
240 OSL_ASSERT(pTemp2 != nullptr);
241 rtl::str::Copy(pTemp2->buffer, pTemp->buffer, nDestBytes);
242 rtl_freeString( pTemp );
243 pTemp = pTemp2;
245 else
247 pTemp->length = nDestBytes;
248 pTemp->buffer[nDestBytes] = 0;
251 rtl_destroyUnicodeToTextConverter( hConverter );
252 if ( *pTarget )
253 rtl_string_release( *pTarget );
254 *pTarget = pTemp;
256 /* Results the conversion in an empty buffer -
257 create an empty string */
258 if ( pTemp && !nDestBytes )
259 rtl_string_new( pTarget );
261 return true;
264 void SAL_CALL rtl_uString2String( rtl_String** ppThis,
265 const sal_Unicode* pUStr,
266 sal_Int32 nULen,
267 rtl_TextEncoding eTextEncoding,
268 sal_uInt32 nCvtFlags )
269 SAL_THROW_EXTERN_C()
271 rtl_impl_convertUStringToString(ppThis, pUStr, nULen, eTextEncoding,
272 nCvtFlags, false);
275 sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget,
276 sal_Unicode const * pSource,
277 sal_Int32 nLength,
278 rtl_TextEncoding nEncoding,
279 sal_uInt32 nFlags)
280 SAL_THROW_EXTERN_C()
282 return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding,
283 nFlags, true);
286 void rtl_string_newReplaceFirst(
287 rtl_String ** newStr, rtl_String * str, char const * from,
288 sal_Int32 fromLength, char const * to, sal_Int32 toLength,
289 sal_Int32 * index) SAL_THROW_EXTERN_C()
291 assert(str != nullptr);
292 assert(index != nullptr);
293 assert(*index >= 0 && *index <= str->length);
294 assert(fromLength >= 0);
295 assert(toLength >= 0);
296 sal_Int32 i = rtl_str_indexOfStr_WithLength(
297 str->buffer + *index, str->length - *index, from, fromLength);
298 if (i == -1) {
299 rtl_string_assign(newStr, str);
300 } else {
301 assert(i <= str->length - *index);
302 i += *index;
303 assert(fromLength <= str->length);
304 if (str->length - fromLength > SAL_MAX_INT32 - toLength) {
305 std::abort();
307 rtl::str::newReplaceStrAt(newStr, str, i, fromLength, to, toLength);
309 *index = i;
312 void rtl_string_newReplaceAll(
313 rtl_String ** newStr, rtl_String * str, char const * from,
314 sal_Int32 fromLength, char const * to, sal_Int32 toLength)
315 SAL_THROW_EXTERN_C()
317 rtl::str::newReplaceAllFromIndex(newStr, str, from, fromLength, to, toLength, 0);
320 sal_Int32 SAL_CALL rtl_str_getLength(const char* pStr) SAL_THROW_EXTERN_C()
322 return rtl::str::getLength(pStr);
325 sal_Int32 SAL_CALL rtl_str_compare(const char* pStr1, const char* pStr2) SAL_THROW_EXTERN_C()
327 return rtl::str::compare(rtl::str::null_terminated(pStr1), rtl::str::null_terminated(pStr2),
328 rtl::str::CompareNormal(), rtl::str::noShortening);
331 sal_Int32 SAL_CALL rtl_str_compare_WithLength(const char* pStr1, sal_Int32 nStr1Len,
332 const char* pStr2, sal_Int32 nStr2Len)
333 SAL_THROW_EXTERN_C()
335 return rtl::str::compare(rtl::str::with_length(pStr1, nStr1Len),
336 rtl::str::with_length(pStr2, nStr2Len),
337 rtl::str::CompareNormal(), rtl::str::noShortening);
340 sal_Int32 SAL_CALL rtl_str_shortenedCompare_WithLength(const char* pStr1, sal_Int32 nStr1Len,
341 const char* pStr2, sal_Int32 nStr2Len,
342 sal_Int32 nShortenedLength)
343 SAL_THROW_EXTERN_C()
345 return rtl::str::compare(rtl::str::with_length(pStr1, nStr1Len),
346 rtl::str::with_length(pStr2, nStr2Len),
347 rtl::str::CompareNormal(), nShortenedLength);
350 sal_Int32 SAL_CALL rtl_str_reverseCompare_WithLength(const char* pStr1, sal_Int32 nStr1Len,
351 const char* pStr2, sal_Int32 nStr2Len)
352 SAL_THROW_EXTERN_C()
354 return rtl::str::reverseCompare_WithLengths(pStr1, nStr1Len, pStr2, nStr2Len,
355 rtl::str::CompareNormal());
358 sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase(const char* pStr1, const char* pStr2)
359 SAL_THROW_EXTERN_C()
361 return rtl::str::compare(rtl::str::null_terminated(pStr1), rtl::str::null_terminated(pStr2),
362 rtl::str::CompareIgnoreAsciiCase(), rtl::str::noShortening);
365 sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase_WithLength(const char* pStr1, sal_Int32 nStr1Len,
366 const char* pStr2, sal_Int32 nStr2Len)
367 SAL_THROW_EXTERN_C()
369 return rtl::str::compare(rtl::str::with_length(pStr1, nStr1Len),
370 rtl::str::with_length(pStr2, nStr2Len),
371 rtl::str::CompareIgnoreAsciiCase(), rtl::str::noShortening);
374 sal_Int32 SAL_CALL rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
375 const char* pStr1, sal_Int32 nStr1Len, const char* pStr2, sal_Int32 nStr2Len,
376 sal_Int32 nShortenedLength) SAL_THROW_EXTERN_C()
378 return rtl::str::compare(rtl::str::with_length(pStr1, nStr1Len),
379 rtl::str::with_length(pStr2, nStr2Len),
380 rtl::str::CompareIgnoreAsciiCase(), nShortenedLength);
383 sal_Int32 SAL_CALL rtl_str_hashCode(const char* pStr) SAL_THROW_EXTERN_C()
385 return rtl::str::hashCode(pStr);
388 sal_Int32 SAL_CALL rtl_str_hashCode_WithLength(const char* pStr, sal_Int32 nLen)
389 SAL_THROW_EXTERN_C()
391 return rtl::str::hashCode_WithLength(pStr, nLen);
394 sal_Int32 SAL_CALL rtl_str_indexOfChar(const char* pStr, char c) SAL_THROW_EXTERN_C()
396 return rtl::str::indexOfChar(pStr, c);
399 sal_Int32 SAL_CALL rtl_str_indexOfChar_WithLength(const char* pStr, sal_Int32 nLen, char c)
400 SAL_THROW_EXTERN_C()
402 return rtl::str::indexOfChar_WithLength(pStr, nLen, c);
405 sal_Int32 SAL_CALL rtl_str_lastIndexOfChar(const char* pStr, char c) SAL_THROW_EXTERN_C()
407 return rtl::str::lastIndexOfChar(pStr, c);
410 sal_Int32 SAL_CALL rtl_str_lastIndexOfChar_WithLength(const char* pStr, sal_Int32 nLen, char c)
411 SAL_THROW_EXTERN_C()
413 return rtl::str::lastIndexOfChar_WithLength(pStr, nLen, c);
416 sal_Int32 SAL_CALL rtl_str_indexOfStr(const char* pStr, const char* pSubStr) SAL_THROW_EXTERN_C()
418 return rtl::str::indexOfStr(pStr, pSubStr);
421 sal_Int32 SAL_CALL rtl_str_indexOfStr_WithLength(const char* pStr, sal_Int32 nStrLen,
422 const char* pSubStr, sal_Int32 nSubLen)
423 SAL_THROW_EXTERN_C()
425 return rtl::str::indexOfStr_WithLength(pStr, nStrLen, pSubStr, nSubLen);
428 sal_Int32 SAL_CALL rtl_str_lastIndexOfStr(const char* pStr, const char* pSubStr)
429 SAL_THROW_EXTERN_C()
431 return rtl::str::lastIndexOfStr(pStr, pSubStr);
434 sal_Int32 SAL_CALL rtl_str_lastIndexOfStr_WithLength(const char* pStr, sal_Int32 nStrLen,
435 const char* pSubStr, sal_Int32 nSubLen)
436 SAL_THROW_EXTERN_C()
438 return rtl::str::lastIndexOfStr_WithLength(pStr, nStrLen, pSubStr, nSubLen);
441 void SAL_CALL rtl_str_replaceChar(char* pStr, char cOld, char cNew) SAL_THROW_EXTERN_C()
443 return rtl::str::replaceChars(rtl::str::null_terminated(pStr), rtl::str::FromTo(cOld, cNew));
446 void SAL_CALL rtl_str_replaceChar_WithLength(char* pStr, sal_Int32 nLen, char cOld, char cNew)
447 SAL_THROW_EXTERN_C()
449 return rtl::str::replaceChars(rtl::str::with_length(pStr, nLen), rtl::str::FromTo(cOld, cNew));
452 void SAL_CALL rtl_str_toAsciiLowerCase(char* pStr) SAL_THROW_EXTERN_C()
454 return rtl::str::replaceChars(rtl::str::null_terminated(pStr), rtl::str::toAsciiLower);
457 void SAL_CALL rtl_str_toAsciiLowerCase_WithLength(char* pStr, sal_Int32 nLen) SAL_THROW_EXTERN_C()
459 return rtl::str::replaceChars(rtl::str::with_length(pStr, nLen), rtl::str::toAsciiLower);
462 void SAL_CALL rtl_str_toAsciiUpperCase(char* pStr) SAL_THROW_EXTERN_C()
464 return rtl::str::replaceChars(rtl::str::null_terminated(pStr), rtl::str::toAsciiUpper);
467 void SAL_CALL rtl_str_toAsciiUpperCase_WithLength(char* pStr, sal_Int32 nLen) SAL_THROW_EXTERN_C()
469 return rtl::str::replaceChars(rtl::str::with_length(pStr, nLen), rtl::str::toAsciiUpper);
472 sal_Int32 SAL_CALL rtl_str_trim(char* pStr) SAL_THROW_EXTERN_C() { return rtl::str::trim(pStr); }
474 sal_Int32 SAL_CALL rtl_str_trim_WithLength(char* pStr, sal_Int32 nLen) SAL_THROW_EXTERN_C()
476 return rtl::str::trim_WithLength(pStr, nLen);
479 sal_Int32 SAL_CALL rtl_str_valueOfBoolean(char* pStr, sal_Bool b) SAL_THROW_EXTERN_C()
481 return rtl::str::valueOfBoolean(pStr, b);
484 sal_Int32 SAL_CALL rtl_str_valueOfChar(char* pStr, char c) SAL_THROW_EXTERN_C()
486 return rtl::str::valueOfChar(pStr, c);
489 sal_Int32 SAL_CALL rtl_str_valueOfInt32(char* pStr, sal_Int32 n, sal_Int16 nRadix)
490 SAL_THROW_EXTERN_C()
492 return rtl::str::valueOfInt<RTL_STR_MAX_VALUEOFINT32>(pStr, n, nRadix);
495 sal_Int32 SAL_CALL rtl_str_valueOfInt64(char* pStr, sal_Int64 n, sal_Int16 nRadix)
496 SAL_THROW_EXTERN_C()
498 return rtl::str::valueOfInt<RTL_STR_MAX_VALUEOFINT64>(pStr, n, nRadix);
501 sal_Int32 SAL_CALL rtl_str_valueOfUInt64(char* pStr, sal_uInt64 n, sal_Int16 nRadix)
502 SAL_THROW_EXTERN_C()
504 return rtl::str::valueOfInt<RTL_STR_MAX_VALUEOFUINT64>(pStr, n, nRadix);
507 sal_Bool SAL_CALL rtl_str_toBoolean(const char* pStr) SAL_THROW_EXTERN_C()
509 return rtl::str::toBoolean(pStr);
512 sal_Int32 SAL_CALL rtl_str_toInt32(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
514 return rtl::str::toInt<sal_Int32>(rtl::str::null_terminated(pStr), nRadix);
517 sal_Int64 SAL_CALL rtl_str_toInt64(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
519 return rtl::str::toInt<sal_Int64>(rtl::str::null_terminated(pStr), nRadix);
522 sal_Int64 SAL_CALL rtl_str_toInt64_WithLength(const char* pStr, sal_Int16 nRadix,
523 sal_Int32 nStrLength) SAL_THROW_EXTERN_C()
525 return rtl::str::toInt<sal_Int64>(rtl::str::with_length(pStr, nStrLength), nRadix);
528 sal_uInt32 SAL_CALL rtl_str_toUInt32(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
530 return rtl::str::toInt<sal_uInt32>(rtl::str::null_terminated(pStr), nRadix);
533 sal_uInt64 SAL_CALL rtl_str_toUInt64(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
535 return rtl::str::toInt<sal_uInt64>(rtl::str::null_terminated(pStr), nRadix);
538 rtl_String* rtl_string_ImplAlloc(sal_Int32 nLen) { return rtl::str::Alloc<rtl_String>(nLen); }
540 void SAL_CALL rtl_string_acquire(rtl_String* pThis) SAL_THROW_EXTERN_C()
542 return rtl::str::acquire(pThis);
545 void SAL_CALL rtl_string_release(rtl_String* pThis) SAL_THROW_EXTERN_C()
547 return rtl::str::release(pThis);
550 void SAL_CALL rtl_string_new(rtl_String** ppThis) SAL_THROW_EXTERN_C()
552 return rtl::str::new_(ppThis);
555 rtl_String* SAL_CALL rtl_string_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
557 assert(nLen >= 0);
558 return rtl::str::Alloc<rtl_String>(nLen);
561 void SAL_CALL rtl_string_new_WithLength(rtl_String** ppThis, sal_Int32 nLen) SAL_THROW_EXTERN_C()
563 rtl::str::new_WithLength(ppThis, nLen);
566 void SAL_CALL rtl_string_newFromString(rtl_String** ppThis, const rtl_String* pStr)
567 SAL_THROW_EXTERN_C()
569 rtl::str::newFromString(ppThis, pStr);
572 void SAL_CALL rtl_string_newFromStr(rtl_String** ppThis, const char* pCharStr) SAL_THROW_EXTERN_C()
574 rtl::str::newFromStr(ppThis, pCharStr);
577 void SAL_CALL rtl_string_newFromStr_WithLength(rtl_String** ppThis, const char* pCharStr,
578 sal_Int32 nLen) SAL_THROW_EXTERN_C()
580 rtl::str::newFromStr_WithLength(ppThis, pCharStr, nLen);
583 void SAL_CALL rtl_string_newFromSubString(rtl_String** ppThis, const rtl_String* pFrom,
584 sal_Int32 beginIndex, sal_Int32 count)
585 SAL_THROW_EXTERN_C()
587 rtl::str::newFromSubString(ppThis, pFrom, beginIndex, count);
590 // Used when creating from string literals.
591 void SAL_CALL rtl_string_newFromLiteral(rtl_String** ppThis, const char* pCharStr, sal_Int32 nLen,
592 sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
594 rtl::str::newFromStr_WithLength(ppThis, pCharStr, nLen, allocExtra);
597 void SAL_CALL rtl_string_assign(rtl_String** ppThis, rtl_String* pStr) SAL_THROW_EXTERN_C()
599 rtl::str::assign(ppThis, pStr);
602 sal_Int32 SAL_CALL rtl_string_getLength(const rtl_String* pThis) SAL_THROW_EXTERN_C()
604 return rtl::str::getLength(pThis);
607 char* SAL_CALL rtl_string_getStr(rtl_String* pThis) SAL_THROW_EXTERN_C()
609 return rtl::str::getStr(pThis);
612 void SAL_CALL rtl_string_newConcat(rtl_String** ppThis, rtl_String* pLeft, rtl_String* pRight)
613 SAL_THROW_EXTERN_C()
615 rtl::str::newConcat(ppThis, pLeft, pRight);
618 void SAL_CALL rtl_string_ensureCapacity(rtl_String** ppThis, sal_Int32 size) SAL_THROW_EXTERN_C()
620 rtl::str::ensureCapacity(ppThis, size);
623 void SAL_CALL rtl_string_newReplaceStrAt(rtl_String** ppThis, rtl_String* pStr, sal_Int32 nIndex,
624 sal_Int32 nCount, rtl_String* pNewSubStr)
625 SAL_THROW_EXTERN_C()
627 rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, pNewSubStr);
630 void SAL_CALL rtl_string_newReplaceStrAt_WithLength(rtl_String** ppThis, rtl_String* pStr, sal_Int32 nIndex,
631 sal_Int32 nCount, char const * subStr, sal_Int32 substrLen)
632 SAL_THROW_EXTERN_C()
634 rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, subStr, substrLen);
637 void SAL_CALL rtl_string_newReplace(rtl_String** ppThis, rtl_String* pStr, char cOld, char cNew)
638 SAL_THROW_EXTERN_C()
640 rtl::str::newReplaceChars(ppThis, pStr, rtl::str::FromTo(cOld, cNew));
643 void SAL_CALL rtl_string_newToAsciiLowerCase(rtl_String** ppThis, rtl_String* pStr)
644 SAL_THROW_EXTERN_C()
646 rtl::str::newReplaceChars(ppThis, pStr, rtl::str::toAsciiLower);
649 void SAL_CALL rtl_string_newToAsciiUpperCase(rtl_String** ppThis, rtl_String* pStr)
650 SAL_THROW_EXTERN_C()
652 rtl::str::newReplaceChars(ppThis, pStr, rtl::str::toAsciiUpper);
655 void SAL_CALL rtl_string_newTrim(rtl_String** ppThis, rtl_String* pStr) SAL_THROW_EXTERN_C()
657 rtl::str::newTrim(ppThis, pStr);
660 sal_Int32 SAL_CALL rtl_string_getToken(rtl_String** ppThis, rtl_String* pStr, sal_Int32 nToken,
661 char cTok, sal_Int32 nIndex) SAL_THROW_EXTERN_C()
663 return rtl::str::getToken(ppThis, pStr, nToken, cTok, nIndex);
666 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */