Android String Replace replaceKeyWords(StringBuilder sb, String[] keywords, String replaceStr)

Here you can find the source of replaceKeyWords(StringBuilder sb, String[] keywords, String replaceStr)

Description

replace Key Words

Declaration

public static final StringBuilder replaceKeyWords(StringBuilder sb,
        String[] keywords, String replaceStr) 

Method Source Code

//package com.java2s;

public class Main {

    public static final StringBuilder replaceKeyWords(StringBuilder sb,
            String[] keywords, String replaceStr) {
        for (int i = 0; i < keywords.length; i++) {
            String s = keywords[i];
            for (int j = sb.indexOf(s); j > 0; j = sb.indexOf(s)) {
                sb.replace(j, j + s.length(), replaceStr);
            }/*from ww  w.j  a v  a 2  s . c  o m*/
        }
        return sb;
    }
}

Related

  1. replace(String str, Map replacementMap)
  2. replace(final String text, final String fromText, final String toText)
  3. replaceAll(String input, String searchStr, String replaceWithStr)
  4. replaceAllKanaWith(String text, String replacement)
  5. replaceAllKanjiWith(String text, String replacement)
  6. replaceR(String str)
  7. replaceSpace(String str)
  8. replaceStr(String number)
  9. replaceString(String s, Map replacement)