code: public CharSequence process(CharSequence source) {
          if (source != null && source.length() > 0) {
              String stringSource = source instanceof String ? (String) source : source.toString();
  
              // Array to cache founded indexes of sequences
              int[] indexes = new int[escape.length];
              Arrays.fill(indexes, -1);
  
              int length = source.length();
              int offset = 0;
              StringBuilder result = new StringBuilder(length);
              while (offset < length) {
                  // Find next escape sequence
                  int escPosition = -1;
                  int escIndex = -1;
                  for (int i = 0; i < escape.length; i++) {
                      int index;
                      if (indexes[i] < offset) {
                          index = stringSource.indexOf(escape[i][0], offset);
                          indexes[i] = index;
                      } else {
                          index = indexes[i];
                      }
  
                      if (index >= 0 && (index < escPosition || escPosition < 0)) {
                          escPosition = index;
                          escIndex = i;
                      }
                  }
  
                  // If escape sequence is found
                  if (escPosition >= 0) {
                      // replace chars before escape sequence
                      result.append(stringSource, offset, escPosition);
  
                      // Replace sequence
                      result.append(escape[escIndex][1]);
                      offset = escPosition + escape[escIndex][0].length();
                  } else {
                      // Put other string to result sequence 
                      result.append(stringSource, offset, length);
                      offset = length;
                  }
              }
              return result;
          } else {
              return new StringBuilder(0);
          }
      }
docs: Process the text
  
  @param source the sourcetext
  @return the result of text processing
  @see TextProcessor#process(CharSequence)