Build control characters array
517036
private static function buildControlCharacters()
    {
        for ($i = 0; $i <= 31; ++$i) {
            if ($i != 9 && $i != 10 && $i != 13) {
                $find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';
                $replace = chr($i);
                self::$controlCharacters[$find] = $replace;
            }
        }
    }
132055
def array_indented(level, l, quote_char='\'', comma_after=False):
    # type: (int, List[str], str, bool) -> str
    
    out = "[\n"
    for x in l:
        out += (((level+1) * 4) * " ") + '{}{}{}'.format(quote_char, x, quote_char) + ",\n"
    out += ((level * 4) * " ") + "]"
    if comma_after:
        out += ","
    return out
375118
def escape_control_chars!(string)
      string.gsub!(CONTROL_CHARACTERS) do |character|
        UTF8Encoding::REPLACEMENT_SCHEME[character]
      end
      string
    end
768442
private void charArray(char[] vals, int limit) {
        int len;
        char c;
        int left, right;
        String str;
        int instrsPerChunk = 6;
        int maxLen;
        int used;

        left = 0;
        len = vals.length;
        // len/CHUNK + 1 is conservative because len % CHUNK may be 0
        maxLen = 3 + (len / CHUNK + 1) * instrsPerChunk + 1;
        if (limit < maxLen) {
            pushMethod(char.class);
            if (limit < maxLen) {
                throw new IllegalStateException("array size ...");
            }
            charArray(vals, MAX_INSTRUCTIONS);
            popMethod();
            return;
        }

        dest.emit(LDC, len);
        ClassRef.CHAR.emitArrayNew(dest);
        dest.emit(ASTORE, buffer);  // store array reference
        while (left < len) {
            c = vals[left];
            if (c != 0) {
                right = Math.min(len, left + CHUNK);
                used = right - left;
                while (used > 0 && vals[left + used - 1] == 0) {
                    used--;
                }
                if (used > 0) {
                    str = String.copyValueOf(vals, left, used);
                    dest.emit(LDC, str);
                    dest.emit(LDC, 0);
                    dest.emit(LDC, used);
                    dest.emit(ALOAD, buffer);
                    dest.emit(LDC, left);
                    dest.emit(INVOKEVIRTUAL, GET_CHARS);
                    left = right;
                } else {
                    // empty chunk, don't save it
                }
            } else {
                left++;
            }
        }
        dest.emit(ALOAD, buffer);
    }
5687
function handlePlainCharacter(element, char) {
  const prefix = element[typedPrefixKey] || '';
  element[typedPrefixKey] = prefix + char;
  element.selectItemWithTextPrefix(element[typedPrefixKey]);
  setPrefixTimeout(element);
}
1336319
function(value) {
      var s = '';
      var i = 1;
      var len = value.length - 1;
      var c, c2, hex, n, index, length;

      while (i < len) {
        c = value.charAt(i++);

        if (c === '\\') {
          if (i < len) {
            c2 = value.charCodeAt(i);
            if (isLineTerminator(c2)) {
              i++;
              if (c2 === 0x0D && i < len && value.charCodeAt(i) === 0x0A) {
                i++;
              }
              continue;
            }
          }

          c = value.charAt(i++);
          switch (c) {
            case 'b':
              c = '\b';
              break;
            case 't':
              c = '\t';
              break;
            case 'r':
              c = '\r';
              break;
            case 'n':
              c = '\n';
              break;
            case 'v':
              c = '\x0B';
              break;
            case 'f':
              c = '\f';
              break;
            case 'u':
            case 'x':
              if (c === 'u' && i < len && value.charAt(i) === '{') {
                i++;
                index = value.indexOf('}', i);
                if (!~index) {
                  this.unexpected();
                }
                hex = value.substring(i, index);
                i = index + 1;
              } else {
                length = c === 'u' ? 4 : 2;
                hex = value.substr(i, length);
                i += length;
              }
              c = fromCodePoint(parseInt(hex, 16));
              break;
            default:
              if (isOctalDigit(c)) {
                n = c;
                do {
                  c = value.charAt(i);
                  if (!isOctalDigit(c)) {
                    break;
                  }
                  n += c;
                } while (i++ < len && n.length < 3);

                if (n.length > 0 && n.charAt(0) === '0') {
                  n = n.substring(1);
                }
                c = fromCharCode(parseInt(n, 8));
              }
          }
        }
        s += c;
      }

      return s;
    }
710095
@SuppressWarnings("unchecked")
    public static List<Character> getAt(char[] array, Collection indices) {
        return primitiveArrayGet(array, indices);
    }
603215
public static WstxInputSource constructCharArraySource
        (WstxInputSource parent, String fromEntity,
         char[] text, int offset, int len, Location loc, URL src)
    {
    	SystemId sysId = SystemId.construct(loc.getSystemId(), src);
        return new CharArraySource(parent, fromEntity, text, offset, len, loc, sysId);
    }
214616
public static function charAsciiArray()
    {
        static $result = array();

        if (!$result) {
            $result = \array_merge(
                self::charAsciiControlArray(),
                self::charAsciiPrintableArray()
            );
        }

        return $result;
    }
331617
def remove_control_chars(self):
        
        esc_key = Literal('\x1b')
        integer = Word(nums)
        escape_seq = Combine(
            esc_key + '[' + Optional(delimitedList(integer, ';')) +
            oneOf(list(alphas)))

        return Suppress(escape_seq).transformString(self.string)
522593
function padValues(arr, strategy, offset, char) {
    /* istanbul ignore if */
    if (!is_1.isValue(arr) || !is_1.isArray(arr))
        return null;
    // If offset is a string
    // count its length.
    if (is_1.isString(offset))
        offset = offset.length;
    // do nothing.
    if (strategy === 'none')
        return arr;
    var len = 0;
    strategy = strategy || 'right';
    char = char || ' ';
    var func = strategy === 'right' ? padRight : padLeft;
    arr.forEach(function (item) {
        if (item.length > len)
            len = item.length;
    });
    if (offset)
        len += offset;
    arr.forEach(function (item, i) {
        if (item.length < len)
            arr[i] = func(item, len - item.length, null, char);
    });
    return arr;
}
538957
def has_control_chars(i):
        
        if not hasattr(i, 'type_'):
            return False

        if i.type_ != Type.string:
            return False

        if i.token in ('VAR', 'PARAMDECL'):
            return True  # We don't know what an alphanumeric variable will hold

        if i.token == 'STRING':
            for c in i.value:
                if 15 < ord(c) < 22:  # is it an attr char?
                    return True
            return False

        for j in i.children:
            if Translator.has_control_chars(j):
                return True

        return False
1015854
private static String encode(String text, char[][] array) {
		int len;
		if ((text == null) || ((len = text.length()) == 0)) {
			return StrUtil.EMPTY;
		}
		StringBuilder buffer = new StringBuilder(len + (len >> 2));
		char c;
		for (int i = 0; i < len; i++) {
			c = text.charAt(i);
			if (c < 64) {
				buffer.append(array[c]);
			} else {
				buffer.append(c);
			}
		}
		return buffer.toString();
	}
227362
private String createValueString(String[] values) {

        StringBuffer buf = new StringBuffer();

        for (int i = 0; i < values.length; i++) {

            // escape commas and equals in value
            values[i] = CmsStringUtil.substitute(values[i], ",", "\\,");
            values[i] = CmsStringUtil.substitute(values[i], "=", "\\=");

            buf.append("\t" + values[i] + ((i < (values.length - 1)) ? ",\\\n" : ""));
        }
        return buf.toString();
    }
474038
private static void shiftArray(char [] dest,int start, int e, char subChar){
        int w = e;
        int r = e;
        while (--r >= start) {
          char ch = dest[r];
          if (ch != subChar) {
            --w;
            if (w != r) {
              dest[w] = ch;
            }
          }
        }
   }
1021029
public function controlDataForJs()
    {
        return [
            // Text Control
            'size'               => $this->size(),
            'min_length'         => $this->minLength(),
            'max_length'         => $this->maxLength(),

            // Base Control
            'input_name'         => $this->inputName(),
            'input_val'          => $this->inputVal(),

            // Base Property
            'readOnly'           => $this->readOnly(),
            'required'           => $this->required(),
            'l10n'               => $this->property()->l10n(),
            'multiple'           => $this->multiple(),
            'multiple_separator' => $this->property()->multipleSeparator(),
            'multiple_options'   => $this->property()->multipleOptions(),
        ];
    }
430003
function tokenize() {
		var ch = walker.ch;
	
		if (ch === " " || ch === "\t") {
			return white();
		}

		if (ch === '/') {
			return comment();
		} 

		if (ch === '"' || ch === "'") {
			return str();
		}
		
		if (ch === '(') {
			return brace();
		}
	
		if (ch === '-' || ch === '.' || isDigit(ch)) { // tricky - char: minus (-1px) or dash (-moz-stuff)
			return num();
		}
	
		if (isNameChar(ch)) {
			return identifier();
		}

		if (isOp(ch)) {
			return op();
		}

		if (ch === '\r') {
			if (walker.peek() === '\n') {
				ch += walker.nextChar();
			}

			tokener(ch, 'line');
			walker.nextChar();
			return;
		}
		
		if (ch === '\n') {
			tokener(ch, 'line');
			walker.nextChar();
			return;
		}
		
		raiseError("Unrecognized character '" + ch + "'");
	}