docs: public static String escapeValue(String s) {
          if (s.isEmpty()) {
              return s;
          }
          if (!s.contains(",") &&
              !s.contains("\\") &&
              !Character.isWhitespace(s.charAt(0)) &&
              !Character.isWhitespace(s.charAt(s.length() - 1))) {
              return s;
          }
  
          StringBuilder b = new StringBuilder(s.length() * 2);
          int begin = 0;
          int end = s.length();
  
          // Escape all whitespace at the front of the string.
          for (; begin < end && Character.isWhitespace(s.charAt(begin)); begin++) {
              b.append('\\').append(s.charAt(begin));
          }
  
          // Skip all whitespace at the end of the string.
          while (end > begin && Character.isWhitespace(s.charAt(end - 1))) {
              end--;
          }
  
          for (int i = begin; i < end; i++) {
              char c = s.charAt(i);
              if (c == '\\' || c == ',') {
                  b.append(s, begin, i).append('\\');
                  begin = i;
              }
          }
  
          b.append(s, begin, end);
  
          // Escape all whitespace at the end of the string.
          for (int i = end; i < s.length(); i++) {
              b.append('\\').append(s.charAt(i));
          }
  
          return b.toString();
      }