code: public static String quoteEscaped(final String str) {
          if (N.isNullOrEmpty(str)) {
              return str;
          }
  
          final StringBuilder sb = Objectory.createStringBuilder();
          final char[] chars = getCharsForReadOnly(str);
  
          try {
              char ch = 0;
              for (int i = 0, len = str.length(); i < len; i++) {
                  ch = chars[i];
  
                  if ((ch == _BACKSLASH) && (i < (len - 1))) {
                      sb.append(ch);
                      sb.append(str.charAt(++i));
                  } else if ((ch == _QUOTATION_S) || (ch == _QUOTATION_D)) {
                      sb.append(_BACKSLASH);
                      sb.append(ch);
                  } else {
                      sb.append(ch);
                  }
              }
  
              return sb.toString();
          } finally {
              Objectory.recycle(sb);
          }
      }
docs: Replace ''' or '"' with '\'' or '\"' if the previous char of the
  quotation is not '\'. original String is returned if the specified String
  is {@code null} or empty.
  
  @param str
  @return