code: static String replaceAll(String s, Pattern p, String r) {
          int n = s == null ? 0 : s.length();
          if (n == 0) {
              return s;
          }
          Matcher m = p.matcher(s);
          if (!m.find()) {
              return s;
          }
          StringBuilder buf = new StringBuilder(n + 12);
          int k = 0;
          do {
              buf.append(s, k, m.start());
              buf.append(r);
              k = m.end();
          } while (m.find());
          if (k < n) {
              buf.append(s, k, n);
          }
          return buf.toString();
      }
docs: Replace a pattern in a string.
  <p>
  Do not do recursive replacement. Return the original string if no changes
  are required.
  
  @param s
  The string to search.
  
  @param p
  The pattern to search for.
  
  @param r
  The string to replace occurrences with.
  
  @return The new string.