Return the soundex code for given character

           :param char:
               Character whose soundex code is needed
           :return:
               Returns soundex code if character is found in charmap
               else returns 0
508646
def soundexCode(self, char):
        '''
        '''
        lang = get_language(char)
        try:
            if lang == "en_US":
                return _soundex_map["soundex_en"][charmap[lang].index(char)]
            else:
                return _soundex_map["soundex"][charmap[lang].index(char)]
        except:
            # Case of exception KeyError because we don't have soundex
            # mapping for the character
            pass

        return 0
938095
def type_string(self, char_string, interval=0):
        
        shift = False
        for char in char_string:
            if self.is_char_shifted(char):
                if not shift:  # Only press Shift as needed
                    time.sleep(interval)
                    self.press_key(self.shift_key)
                    shift = True
                #In order to avoid tap_key pressing Shift, we need to pass the
                #unshifted form of the character
                if char in '<>?:"{}|~!@#$%^&*()_+':
                    ch_index = '<>?:"{}|~!@#$%^&*()_+'.index(char)
                    unshifted_char = ",./;'[]\\`1234567890-="[ch_index]
                else:
                    unshifted_char = char.lower()
                time.sleep(interval)
                self.tap_key(unshifted_char)
            else:  # Unshifted already
                if shift and char != ' ':  # Only release Shift as needed
                    self.release_key(self.shift_key)
                    shift = False
                time.sleep(interval)
                self.tap_key(char)

        if shift:  # Turn off Shift if it's still ON
            self.release_key(self.shift_key)
73330
def _try_char(character, backup, encoding=sys.stdout.encoding):
    
    if character.encode(encoding, 'replace') == b'?':
        return backup
    else:
        return character
754495
def consume(self, char):
        

        if self.state == "stream":
            self._stream(char)
        elif self.state == "escape":
            self._escape_sequence(char)
        elif self.state == "escape-lb":
            self._escape_parameters(char)
        elif self.state == "mode":
            self._mode(char)
        elif self.state == "charset-g0":
            self._charset_g0(char)
        elif self.state == "charset-g1":
            self._charset_g1(char)
1294427
function _Char_toCode(char)
{
	var code = char.charCodeAt(0);
	if (0xD800 <= code && code <= 0xDBFF)
	{
		return (code - 0xD800) * 0x400 + char.charCodeAt(1) - 0xDC00 + 0x10000
	}
	return code;
}
485829
public Character getChar(String name) {
        Object o = get(name);
        if (o instanceof Character) {
            return (Character)o;
        }

        if (o != null) {
            String string = o.toString();
            if (string != null && string.length() == 1) {
                return string.charAt(0);
            }
        }
        return null;
    }
387141
function (char) {
                var
                    escapeChar = this._escapeChar,
                    count;
                if (char === escapeChar) {
                    count = ++this._escapeCount;
                    if ("-" === escapeChar && 3 === count) {
                        this._output("&mdash;");
                        return this._parseContent;
                    }
                } else {
                    count = this._escapeCount + 1;
                    while (--count) {
                        this._output(escapeChar);
                    }
                    this._setParserState(this._parseContent);
                    return this._parseContent(char);
                }
            }
523380
def _convert_char_to_type(self, type_char):
        
        typecode = type_char
        if type(type_char) is int:
            typecode = chr(type_char)

        if typecode in self.TYPECODES_LIST:
            return typecode
        else:
            raise RuntimeError(
                "Typecode {0} ({1}) isn't supported.".format(type_char, typecode)
            )
443374
def _get_char(self, win, char):
        def get_check_next_byte():
            char = win.getch()
            if 128 <= char <= 191:
                return char
            else:
                raise UnicodeError

        bytes = []
        if char <= 127:
            # 1 bytes
            bytes.append(char)
        #elif 194 <= char <= 223:
        elif 192 <= char <= 223:
            # 2 bytes
            bytes.append(char)
            bytes.append(get_check_next_byte())
        elif 224 <= char <= 239:
            # 3 bytes
            bytes.append(char)
            bytes.append(get_check_next_byte())
            bytes.append(get_check_next_byte())
        elif 240 <= char <= 244:
            # 4 bytes
            bytes.append(char)
            bytes.append(get_check_next_byte())
            bytes.append(get_check_next_byte())
            bytes.append(get_check_next_byte())
        #print('bytes = {}'.format(bytes))
        
        while 0 in bytes:
            bytes.remove(0)
        if version_info < (3, 0):
            out = ''.join([chr(b) for b in bytes])
        else:
            buf = bytearray(bytes)
            out = self._decode_string(buf)
            #out = buf.decode('utf-8')
        return out
1036476
def expect(self, c):
        
        if self.peek() != c:
            self.error('Expected "%c"' % (c,))
        self.skip_char()
378395
private Character getPadCharacter(String characterString) {
        if (characterString.length() > 0) {
            getLogger().debug("The given character string is longer than one element. The first character is used.");
        }
        return characterString.charAt(0);
    }
168896
def char_width(char):
    
    if ord(char) < 128:
        return 1
    elif unicodedata.east_asian_width(char) in ('F', 'W'):
        return 2
    elif unicodedata.category(char) in ('Mn',):
        return 0
    else:
        return 1
600847
def get_character(self, position, offset=0):
        """"""
        position = self.get_position(position) + offset
        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.End)
        if position < cursor.position():
            cursor.setPosition(position)
            cursor.movePosition(QTextCursor.Right,
                                QTextCursor.KeepAnchor)
            return to_text_string(cursor.selectedText())
        else:
            return ''
663926
def _escape_sequence(self, char):
        

        num = ord(char)
        if char == "[":
            self.state = "escape-lb"
        elif char == "(":
            self.state = "charset-g0"
        elif char == ")":
            self.state = "charset-g1"
        elif num in self.escape:
            self.dispatch(self.escape[num])
            self.state = "stream"
        elif self.fail_on_unknown_esc:
            raise StreamProcessError("Unexpected character '%c' == '0x%02x'" % (char, ord(char)))
461242
def _format_char(char):
    
    if char is None:
        return -1
    if isinstance(char, _STRTYPES) and len(char) == 1:
        return ord(char)
    try:
        return int(char) # allow all int-like objects
    except:
        raise TypeError('char single character string, integer, or None\nReceived: ' + repr(char))
973740
def set_char_callback(window, cbfun):
    
    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value
    if window_addr in _char_callback_repository:
        previous_callback = _char_callback_repository[window_addr]
    else:
        previous_callback = None
    if cbfun is None:
        cbfun = 0
    c_cbfun = _GLFWcharfun(cbfun)
    _char_callback_repository[window_addr] = (cbfun, c_cbfun)
    cbfun = c_cbfun
    _glfw.glfwSetCharCallback(window, cbfun)
    if previous_callback is not None and previous_callback[0] != 0:
        return previous_callback[0]
703152
def _encode_char(char, charmap, defaultchar):
        
        if ord(char) < 128:
            return ord(char)
        if char in charmap:
            return charmap[char]
        return ord(defaultchar)