<commit_before>/**
 * @license
 * Copyright 2020 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.lib.json;

/** JSON Utility methods. **/
public class Util {

  /** Append src string to dst StringBuilder as an escaped JSON string. **/
  public static void escape(String src, StringBuilder dst) {
    char c;
      for ( int i = 0; i < src.length() ; i++ ) {
        c = src.charAt(i);

        switch ( c ) {
          case '\t':
            dst.append("\\t");
            break;
          case '\r':
            dst.append("\\r");
            break;
          case '\n':
            dst.append("\\n");
            break;
          case '\\':
            dst.append("\\\\");
            break;
          case '\"':
            dst.append("\\\"");
            break;
          default:
            if(c >= ' ')
              dst.append(c);
            else {
              char right = (char) (c & 0x0F);
              char left = (char) ((c & 0xF0) >> 4);
              right += '0';
              if ( right > '9' ) right += 'A' - '9' - 1;
              left += '0';
              if ( left > '9' ) left += 'A' - '9' - 1;
              dst.append("\\u00");
              dst.append(left);
              dst.append(right);
            }
        }
      }
  }

}<commit_msg>Spaces added<commit_after>/**
 * @license
 * Copyright 2020 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.lib.json;

/** JSON Utility methods. **/
public class Util {

  /** Append src string to dst StringBuilder as an escaped JSON string. **/
  public static void escape(String src, StringBuilder dst) {
    char c;
      for ( int i = 0; i < src.length() ; i++ ) {
        c = src.charAt(i);

        switch ( c ) {
          case '\t':
            dst.append("\\t");
            break;
          case '\r':
            dst.append("\\r");
            break;
          case '\n':
            dst.append("\\n");
            break;
          case '\\':
            dst.append("\\\\");
            break;
          case '\"':
            dst.append("\\\"");
            break;
          default:
            if ( c >= ' ' )
              dst.append(c);
            else {
              char right = (char) (c & 0x0F);
              char left = (char) ((c & 0xF0) >> 4);
              right += '0';
              if ( right > '9' ) right += 'A' - '9' - 1;
              left += '0';
              if ( left > '9' ) left += 'A' - '9' - 1;
              dst.append("\\u00");
              dst.append(left);
              dst.append(right);
            }
        }
      }
  }

}
{'fraction_non_alphanumeric': 0.17005267118133935, 'fraction_numerical': 0.01655379984951091, 'mean_word_length': 1.1357429718875502, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3800539', 'n_tokens_mistral': 820, 'n_tokens_neox': 790, 'n_words': 210}