Used by key-based sorting (like in python's sorted() with key= parameter)
@param str
@return
350288
public static String getSortKey(String str) {
		StringBuilder ignoreChars = new StringBuilder();
		StringBuilder tailCaps = new StringBuilder(str.length() + 1);
		StringBuilder normChars = new StringBuilder(str.length() + 1 + tailCaps.capacity() + ignoreChars.capacity());
		
		for(int i=0; i<str.length(); i++) {
			char ch = str.charAt(i);
			
			if( isIgnoredChar(ch) ) {
				if( ch == 0x02BC ) {
					ch = 0x2020;
				}
				ignoreChars.append(ch);
				continue;
			}
			
			
			char lowerCh = Character.toLowerCase(ch);
			
			Character sortValue = UK_ALPHABET_MAP.get(lowerCh);
			if (sortValue != null) {
				normChars.append(sortValue);
				tailCaps.append(ch);
			}
			else {
				tailCaps.append(ch);
			}
			
		}
		
		normChars.append(" ");
		tailCaps.append(" ");
		ignoreChars.append(" ");
		
		normChars.append(tailCaps);
		normChars.append(ignoreChars);
		
		return normChars.toString();
	}
623883
public static String sort( String s )
	{
		char[] chars = s.toCharArray();
		Arrays.sort( chars );
		return new String( chars );
	}
407769
public static char lastChar(String str) {
	if (str == null || str.length() == 0) return 0;
	return str.charAt(str.length() - 1);
    }
816202
public static String getSha(String str)
    {
        Check.notNull(str);

        return getSha(str.getBytes(StandardCharsets.UTF_8));
    }
890623
public StringGrabber set(String str) {
		if (str == null)
		{
			str = "";
		}
		return set(new StringBuilder(str));
	}
1010792
public static Parser<Void> string(String str) {
    return Patterns.string(str).toScanner(str);
  }
650658
public static String decode(String str) {
    if (str!=null) {
      try {
        StringBuilder sb = new StringBuilder();
        for (int idx = str.toLowerCase().indexOf("%2f"); idx>=0; idx = str.toLowerCase().indexOf("%2f")) {
          sb.append(java.net.URLDecoder.decode(str.substring(0, idx),"UTF-8")).append(str.substring(idx, idx+3));
          str = str.substring(idx+3);
        }
        sb.append(java.net.URLDecoder.decode(str,"UTF-8"));
        str = sb.toString();
      } catch (Exception ex) {
      }
    }
    return str;
  }
3486
public static Parser<Void> stringCaseInsensitive(String str) {
    return Patterns.stringCaseInsensitive(str).toScanner(str);
  }
1118773
public static TreeSet<CharType> getTypeSet(String str) {
		CharType[] tag = getType(str);
		TreeSet<CharType> set = new TreeSet<CharType>();
		for(int i=0;i<tag.length;i++){
			set.add(tag[i]);			
		}	
		return set;
	}
921866
public String toTrad(String str) {   
		char[] c = str.toCharArray();
		for (int i = 0; i < str.length(); i++) {   
			char cc = s2l.get(c[i]);
			if (cc != 0) {   
				c[i] = cc;   
			} 
		}   
		return new String(c);   
	}
515420
public static BigInteger encodeStringToInteger(String str) {
        byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
        byte[] res;
        if ((bytes[0] & 0b1000_0000) >> 7 == 1) {
            res = new byte[bytes.length + 1];
            res[0] = 0;
            System.arraycopy(bytes, 0, res, 1, bytes.length);
        } else {
            res = bytes;
        }
        BigInteger r = new BigInteger(res);
        assert r.compareTo(BigInteger.ZERO) > 0;
        return r;
    }
1178169
private static InputSource stringToSource(String str) {
        InputSource is = new InputSource(new StringReader(str));
        is.setEncoding("UTF-8");
        return is;
    }
1160798
function orderBy (arr) {
  var comparator = null
  var sortKeys
  arr = util.convertArray(arr)

  // determine order (last argument)
  var args = util.toArray(arguments, 1)
  var order = args[args.length - 1]
  if (typeof order === 'number') {
    order = order < 0 ? -1 : 1
    args = args.length > 1 ? args.slice(0, -1) : args
  } else {
    order = 1
  }

  // determine sortKeys & comparator
  var firstArg = args[0]
  if (!firstArg) {
    return arr
  } else if (typeof firstArg === 'function') {
    // custom comparator
    comparator = function (a, b) {
      return firstArg(a, b) * order
    }
  } else {
    // string keys. flatten first
    sortKeys = Array.prototype.concat.apply([], args)
    comparator = function (a, b, i) {
      i = i || 0
      return i >= sortKeys.length - 1
        ? baseCompare(a, b, i)
        : baseCompare(a, b, i) || comparator(a, b, i + 1)
    }
  }

  function baseCompare (a, b, sortKeyIndex) {
    var sortKey = sortKeys[sortKeyIndex]
    if (sortKey) {
      if (sortKey !== '$key') {
        if (util.isObject(a) && '$value' in a) a = a.$value
        if (util.isObject(b) && '$value' in b) b = b.$value
      }
      a = util.isObject(a) ? util.getPath(a, sortKey) : a
      b = util.isObject(b) ? util.getPath(b, sortKey) : b
    }
    return a === b ? 0 : a > b ? order : -order
  }

  // sort on a copy to avoid mutating original array
  return arr.slice().sort(comparator)
}
1185211
public static String lcFirst(String str) {
	if (str == null) return null;
	else if (str.length() <= 1) return str.toLowerCase();
	else {
	    return str.substring(0, 1).toLowerCase() + str.substring(1);
	}
    }
593134
public static RegExpr createKeyword(String str) {
        int i;
        RegExpr[] chars;

        if (str.length() == 1) {
            return new Range(str.charAt(0));
        } else {
            chars = new RegExpr[str.length()];
            for (i = 0; i < chars.length; i++) {
                chars[i] = new Range(str.charAt(i));
            }
            return new Sequence(chars);
        }
    }
704522
public static int stringToBooleanValueEL(String str) {
	if (str.length() < 2) return -1;
	switch (str.charAt(0)) {
	case 't':
	case 'T':
	    return str.equalsIgnoreCase("true") ? 1 : -1;
	case 'f':
	case 'F':
	    return str.equalsIgnoreCase("false") ? 0 : -1;
	case 'y':
	case 'Y':
	    return str.equalsIgnoreCase("yes") ? 1 : -1;
	case 'n':
	case 'N':
	    return str.equalsIgnoreCase("no") ? 0 : -1;
	}
	return -1;
    }
1159600
public JBBPTextWriter Str(final String... str) throws IOException {
    JBBPUtils.assertNotNull(str, "String must not be null");

    final String oldPrefix = this.prefixValue;
    final String oldPostfix = this.postfixValue;
    this.prefixValue = "";
    this.postfixValue = "";

    for (final String s : str) {
      ensureValueMode();
      printValueString(s == null ? "<NULL>" : s);
    }

    this.prefixValue = oldPrefix;
    this.postfixValue = oldPostfix;
    return this;
  }