1*2be43276SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2be43276SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2be43276SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2be43276SAndrew Rist  * distributed with this work for additional information
6*2be43276SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2be43276SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2be43276SAndrew Rist  * "License"); you may not use this file except in compliance
9*2be43276SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2be43276SAndrew Rist  *
11*2be43276SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2be43276SAndrew Rist  *
13*2be43276SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2be43276SAndrew Rist  * software distributed under the License is distributed on an
15*2be43276SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2be43276SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2be43276SAndrew Rist  * specific language governing permissions and limitations
18*2be43276SAndrew Rist  * under the License.
19*2be43276SAndrew Rist  *
20*2be43276SAndrew Rist  *************************************************************/
21*2be43276SAndrew Rist 
22*2be43276SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package com.sun.star.lib.util;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir /** jurt.jar internal string helper methods.
27cdf0e10cSrcweir  */
28cdf0e10cSrcweir public final class StringHelper
29cdf0e10cSrcweir {
StringHelper()30cdf0e10cSrcweir     private StringHelper() {} // do not instantiate
31cdf0e10cSrcweir 
replace(String str, char from, String to)32cdf0e10cSrcweir     public static String replace(String str, char from, String to) {
33cdf0e10cSrcweir         StringBuffer b = new StringBuffer();
34cdf0e10cSrcweir         for (int i = 0;;) {
35cdf0e10cSrcweir             int j = str.indexOf(from, i);
36cdf0e10cSrcweir             if (j == -1) {
37cdf0e10cSrcweir                 b.append(str.substring(i));
38cdf0e10cSrcweir                 break;
39cdf0e10cSrcweir             } else {
40cdf0e10cSrcweir                 b.append(str.substring(i, j));
41cdf0e10cSrcweir                 b.append(to);
42cdf0e10cSrcweir                 i = j + 1;
43cdf0e10cSrcweir             }
44cdf0e10cSrcweir         }
45cdf0e10cSrcweir         return b.toString();
46cdf0e10cSrcweir     }
47cdf0e10cSrcweir }
48