get index type from string
348210
protected IndexType getIndexType(String type)
    {
        type = type.toLowerCase();
        if ("keys".equals(type))
            return IndexType.KEYS;
        else if("custom".equals(type))
            return IndexType.CUSTOM;
        else if("composites".equals(type))
            return IndexType.COMPOSITES;
        else
            return null;
    }
1371580
protected final int parseIndex(String indexString) {
        try {
            return Integer.parseInt(indexString);
        } catch(Exception e) {
            String msg = "Error converting \"" + indexString + "\" into an integer.  Cause: " + e;
            LOGGER.error(msg, e);
            throw new RuntimeException(msg, e);
        }
    }
344231
function(_string) {
    if ('undefined' == typeof _string) {
      return null;
    }
    else if ('string' != typeof _string) {
      throw new Error('Wrong parameter type');
    }

    var str = _string.reverse();
    var ret = 0;

    for (var i = 0; i <= (str.length - 1); i++) {
      ret = ret + this.index.indexOf(str.substr(i, 1)) * (this.bcpow(this.index.length, (str.length - 1) - i));
    }

    return ret;
  }
1108843
def parse(string):
  ""
  print string
  if string.strip().lower().startswith('create index'): return IndexX(string)
  return YACC.parse(string, lexer=LEXER.clone())
1265604
function getIndexOf(array, value, fromIndex) {
    var result = (result = lodash.indexOf) === indexOf ? basicIndexOf : result;
    return result;
  }
837137
def string(s):
    ''''''
    @Parser
    def string_parser(text, index=0):
        slen, tlen = len(s), len(text)
        if text[index:index + slen] == s:
            return Value.success(index + slen, s)
        else:
            matched = 0
            while matched < slen and index + matched < tlen and text[index + matched] == s[matched]:
                matched = matched + 1
            return Value.failure(index + matched, s)
    return string_parser
547468
function parseSearchString(str) {

    str = tia.cU.replaceXTypesInTeq(str);

    var re = /&(\w|\d|_|-)+/g;

    var searchData = [];
    var prevLastIndex = 0;
    var query;

    while (true) {
      var reResult = re.exec(str);

      if (reResult === null) {
        // Only query string.
        query = str.slice(prevLastIndex).trim();
        if (query) {
          searchData.push({
            query: query,
          });
        }
        return searchData;
      }

      query = str.slice(prevLastIndex, reResult.index).trim();
      var reference = str.slice(reResult.index + 1, re.lastIndex).trim();
      prevLastIndex = re.lastIndex;

      if (query) {
        searchData.push({
          query: query,
        });
      }

      searchData.push({
        reference: reference,
      });

    }
  }
1065680
def get_index_text(self, modname, name_cls):
        """"""
        if self.objtype in ('class', 'record'):
            if not modname:
                return _('%s (built-in %s)') % (name_cls[0], self.objtype)
            return _('%s (%s in %s)') % (name_cls[0], self.objtype, modname)
        else:
            return ''
863798
def parse_to_type(self,**kwargs):
        """"""
        indexes = self.selectedIndexes()
        if not indexes: return
        for index in indexes:
            self.model().parse_data_type(index, **kwargs)
458285
def _fetch_type_sub(cls, cls_in, match):
        

        if match.group(cls._SUBMATCH_INDEX_TYPE_SUB):
            return cls._str_to_type(
                cls_in,
                match.group(cls._SUBMATCH_INDEX_TYPE_SUB)
            )
        else:
            return None
87024
def eval_string_type(self, text, is_string=False):
        """"""

        stype = set()
        wstype = set()

        for m in RE_ITER_STRING_TYPES.finditer(text):
            value = m.group(0)
            if value == '*':
                wstype.add('u')
                wstype.add('f')
                wstype.add('r')
                wstype.add('b')
            elif value.endswith('*'):
                wstype.add(value[0].lower())
            else:
                stype.add(value.lower())

        if is_string and 'b' not in stype and 'f' not in stype:
            stype.add('u')

        return stype, wstype
694108
public LazyType getType(int index) throws LazyException{
		LazyNode token=getValueToken(index);
		switch(token.type){
			case LazyNode.OBJECT: return LazyType.OBJECT;
			case LazyNode.ARRAY: return LazyType.ARRAY;
			case LazyNode.VALUE_TRUE: return LazyType.BOOLEAN;
			case LazyNode.VALUE_FALSE: return LazyType.BOOLEAN;
			case LazyNode.VALUE_NULL: return LazyType.NULL;
			case LazyNode.VALUE_STRING: return LazyType.STRING;
			case LazyNode.VALUE_ESTRING: return LazyType.STRING;
			case LazyNode.VALUE_INTEGER: return LazyType.INTEGER;
			case LazyNode.VALUE_FLOAT: return LazyType.FLOAT;
		}
		return null;
	}
366398
def _get_alphanumeric_index(query_string):
        
        # TODO: could probably rework this. it works, but it's ugly as hell.
        try:
            return [int(query_string), 'int']
        except ValueError:
            if len(query_string) == 1:
                if query_string.isupper():
                    return [string.ascii_uppercase.index(query_string), 'char_hi']
                elif query_string.islower():
                    return [string.ascii_lowercase.index(query_string), 'char_lo']
            else:
                raise IOError('The input is a string longer than one character')
1344379
def _ex_type_str(exobj):
    """"""
    regexp = re.compile(r"<(?:\bclass\b|\btype\b)\s+'?([\w|\.]+)'?>")
    exc_type = str(exobj)
    if regexp.match(exc_type):
        exc_type = regexp.match(exc_type).groups()[0]
        exc_type = exc_type[11:] if exc_type.startswith("exceptions.") else exc_type
    if "." in exc_type:
        exc_type = exc_type.split(".")[-1]
    return exc_type
761118
private static int indexOfNonDigit(String string, int offset) {
        for (int i = offset; i < string.length(); i++) {
            char c = string.charAt(i);
            if (c < '0' || c > '9') return i;
        }
        return string.length();
    }
32947
def get_index_text(self, prefix, name_obj):
        """"""
        (name, _) = name_obj
        msg = '{name} ({obj_type})'
        parts = {
            'name': name,
            'prefix': prefix,
            'obj_type': self.long_name,
        }
        try:
            (obj_ns, obj_name) = name.rsplit('.', 1)
            parts['name'] = obj_name
            parts['namespace'] = obj_ns
            msg = '{name} ({namespace} {obj_type})'
        except ValueError:
            pass

        return msg.format(**parts)
931111
function(string) {
		var index = this.stringLookupQuick[string];
		// If missing, allocate now
		if (index === undefined) {
			index = this.stringLookup.length;
			this.stringLookup.push( string );
			this.stringLookupQuick[string]= index;
		}
		return index;
	}