Returns the direction code that corresponds to the supplied short string or {@link #NONE}
if the string does not correspond to a known direction code.
776131
public static int fromShortString (String dirstr)
    {
        for (int ii = 0; ii < FINE_DIRECTION_COUNT; ii++) {
            if (SHORT_DIR_STRINGS[ii].equals(dirstr)) {
                return ii;
            }
        }
        return NONE;
    }
823763
public static final Function<Short,String> toCurrencyStr() {
        return (Function<Short,String>)((Function)FnNumber.toCurrencyStr());
    }
38661
public Direction direction() {
        if (!Op.isFinite(slope) || Op.isEq(slope, 0.0)) {
            return Direction.Zero;
        }
        if (Op.isGt(slope, 0.0)) {
            return Direction.Positive;
        }
        return Direction.Negative;
    }
428403
public boolean isStringTerminal() {
    if (getChar() == NodewalkerCodec.END_OF_STRING) return true;
    if (getChar() == NodewalkerCodec.FALLBACK && null != getParent()) return getParent().isStringTerminal();
    return false;
  }
253501
public Direction isNeighborOf( GridNode otherNode ) {
        Direction[] orderedDirs = Direction.getOrderedDirs();
        for( int i = 0; i < orderedDirs.length; i++ ) {
            Direction direction = orderedDirs[i];
            int newCol = col + direction.col;
            int newRow = row + direction.row;
            if (otherNode.col == newCol && otherNode.row == newRow) {
                return direction;
            }
        }
        return null;
    }
1195608
public static String reverse(final String string) {

    return isEmpty(string) ? string : new StringBuilder(string).reverse().toString();
  }
939244
public int DamerauLevenshteinDistance(String string2, int maxDistance) {
        if (baseString == null) return string2 == null ? 0 : string2.length(); //string2 ?? "").Length;
        if (string2 == null || string2.isEmpty()) return baseString.length();
        if(maxDistance == 0) return baseString.equals(string2) ? 0 : -1;

        // if strings of different lengths, ensure shorter string is in string1. This can result in a little
        // faster speed by spending more time spinning just the inner loop during the main processing.
        String string1;
        if (baseString.length() > string2.length()) {
            string1 = string2;
            string2 = baseString;
        } else {
            string1 = baseString;
        }
        int sLen = string1.length(); // this is also the minimun length of the two strings
        int tLen = string2.length();

        // suffix common to both strings can be ignored
        while ((sLen > 0) && (string1.charAt(sLen - 1) == string2.charAt(tLen - 1))) { sLen--; tLen--; }

        int start = 0;
        if ((string1.charAt(0) == string2.charAt(0)) || (sLen == 0)) { // if there'string1 a shared prefix, or all string1 matches string2'string1 suffix
            // prefix common to both strings can be ignored
            while ((start < sLen) && (string1.charAt(start) == string2.charAt(start))) start++;
            sLen -= start; // length of the part excluding common prefix and suffix
            tLen -= start;

            // if all of shorter string matches prefix and/or suffix of longer string, then
            // edit distance is just the delete of additional characters present in longer string
            if (sLen == 0) return tLen;

            string2 = string2.substring(start, start + tLen); // faster than string2[start+j] in inner loop below
        }
        int lenDiff = tLen - sLen;
        if ((maxDistance < 0) || (maxDistance > tLen)) {
            maxDistance = tLen;
        } else if (lenDiff > maxDistance) return -1;

        if (tLen > v0.length)
        {
            v0 = new int[tLen];
            v2 = new int[tLen];
        } else {
            for(int i = 0; i < tLen; i++) v2[i] = 0;    // Substituting Array.clear(v2, 0, tLen)
        }
        int j;
        for (j = 0; j < maxDistance; j++) v0[j] = j + 1;
        for (; j < tLen; j++) v0[j] = maxDistance + 1;

        int jStartOffset = maxDistance - (tLen - sLen);
        boolean haveMax = maxDistance < tLen;
        int jStart = 0;
        int jEnd = maxDistance;
        char sChar = string1.charAt(0);
        int current = 0;
        for (int i = 0; i < sLen; i++) {
            char prevsChar = sChar;
            sChar = string1.charAt(start+i);
            char tChar = string2.charAt(0);
            int left = i;
            current = left + 1;
            int nextTransCost = 0;
            // no need to look beyond window of lower right diagonal - maxDistance cells (lower right diag is i - lenDiff)
            // and the upper left diagonal + maxDistance cells (upper left is i)
            jStart += (i > jStartOffset) ? 1 : 0;
            jEnd += (jEnd < tLen) ? 1 : 0;
            for (j = jStart; j < jEnd; j++) {
                int above = current;
                int thisTransCost = nextTransCost;
                nextTransCost = v2[j];
                v2[j] = current = left; // cost of diagonal (substitution)
                left = v0[j];    // left now equals current cost (which will be diagonal at next iteration)
                char prevtChar = tChar;
                tChar = string2.charAt(j);
                if (sChar != tChar) {
                    if (left < current) current = left;   // insertion
                    if (above < current) current = above; // deletion
                    current++;
                    if ((i != 0) && (j != 0)
                            && (sChar == prevtChar)
                            && (prevsChar == tChar)) {
                        thisTransCost++;
                        if (thisTransCost < current) current = thisTransCost; // transposition
                    }
                }
                v0[j] = current;
            }
            if (haveMax && (v0[i + lenDiff] > maxDistance)) return -1;
        }
        return (current <= maxDistance) ? current : -1;
    }
600132
public Short getAsShort(String key) {
        Object value = mValues.get(key);
        try {
            return value != null ? ((Number) value).shortValue() : null;
        } catch (ClassCastException e) {
            if (value instanceof CharSequence) {
                try {
                    return Short.valueOf(value.toString());
                } catch (NumberFormatException e2) {
                    logger.severe("Cannot parse Short value for " + value + " at key " + key);
                    return null;
                }
            } else {
                logger.log(Level.SEVERE,"Cannot cast value for " + key + " to a Short: " + value, e);
                return null;
            }
        }
    }
1122736
public int lookupIndex(short value) {
        for (int i=0; i<elements.length; i++) {
            if (elements[i] == value) {
                return i;
            }
        }
        return -1;
    }
737445
public int find(String string) {
        if (m_strings == null) {
            return -1;
        }

        for (int i = 0; i < m_strings.length - 1; i++) {
            if (m_strings[i].equals(string)) {
                return i;
            }
        }

        return -1;
    }
14150
public static String getDigitsOnly(String s) {
        if (isEmpty(s)) return s;
        String rslt = s.trim();
        if (isEmpty(rslt)) return rslt;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < rslt.length(); i++) {
            char ch = rslt.charAt(i);
            if (Character.isDigit(ch)) sb.append(ch);
        }
        return sb.toString();
    }
1068055
public static boolean isLetterAndNumber(String string) {
        boolean result = isNotEmpty(string);
        int idx = 0;
        int len = string.length();
        while (result) {
            if (idx >= len) {
                break;
            }
            char c = string.charAt(idx);
            result = isLetter(c) || isNumber(c);
            idx++;
        }
        return result;
    }
1137064
public short getPropAsShort(String key, short def) {
    return Short.parseShort(getProp(key, String.valueOf(def)));
  }
1092938
public short getShort( String key )
        throws MissingResourceException
    {
        ResourceBundle bundle = getBundle();
        String value = bundle.getString( key );
        try
        {
            return Short.parseShort( value );
        }
        catch( NumberFormatException nfe )
        {
            throw new MissingResourceException( "Expecting a short value but got " + value,
                                                "java.lang.String",
                                                key
            );
        }
    }
732307
public char skip(int n)
  {
    _pos += n;
    
    if (_length <= _pos) {
      _pos = _string.length();
      return DONE;
    } else
      return _string.charAt(_pos);
  }
171710
@Nullable
    public static String shortenURI(@Nullable final URI uri) {
        if (uri == null) {
            return null;
        }
        final String prefix = Data.namespaceToPrefix(uri.getNamespace(), Data.getNamespaceMap());
        if (prefix != null) {
            return prefix + ':' + uri.getLocalName();
        }
        final String ns = uri.getNamespace();
        return "&lt;.." + uri.stringValue().substring(ns.length() - 1) + "&gt;";
        // final int index = uri.stringValue().lastIndexOf('/');
        // if (index >= 0) {
        // return "&lt;.." + uri.stringValue().substring(index) + "&gt;";
        // }
        // return "&lt;" + uri.stringValue() + "&gt;";
    }
574077
def direction(self, direction):
        
        if not isinstance(direction, str):
            raise TypeError("direction must be of type str")

        accepted_values = ['i', 'x', 'y', 'z', 's', 'c']
        if direction not in accepted_values:
            raise ValueError("must be one of: {}".format(accepted_values))

        self._direction = direction