shortName("123456789", 8, 3) = "12...789"

shortName("123456789", 8, 2) = "123...89"
516520
public static String shortName(String str, int length, int rightLength) {
		if (str.length() > length) {
			int leftIndex = length - 3 - rightLength;
			str = str.substring(0, Math.max(0, leftIndex)) + "..."
					+ str.substring(Math.max(0, str.length() - rightLength), str.length());
		}
		return str;
	}
911115
def fullName(self):
        
        if self.givenName and self.sn:
            return "{0} {1}".format(self.givenName, self.sn)
        if self.givenName:
            return self.givenName
        if self.sn:
            return self.sn
        return self.uid
777297
function getLastNumber(str){
					var retval="";
					for (var i=str.length-1;i>=0;--i)
						if (str[i]>="0"&&str[i]<="9")
							retval=str[i]+retval;
					if (retval.length==0) return "0";
					return retval;
				}
397440
function(s){
        if (s.substr(0, 2) === '02' || s.substr(0, 2) === '03' || s.substr(0, 2) === '04' || s.substr(0, 2) === '07' || s.substr(0, 2) === '08') return true;
        return (s.substr(0, 2) === '61') || (s.substr(0, 4) === '0061');
    }
193149
def NumbersToWords(number):
    

    units = [
        'one',
        'two',
        'three',
        'four',
        'five',
        'six',
        'seven',
        'eight',
        'nine']
    tens = [
        'ten',
        'twenty',
        'thirty',
        'forty',
        'fifty',
        'sixty',
        'seventy',
        'eighty',
        'ninety']
    output = ""
    if number != 0:
        str_val = str(number)
        if 4 > len(str_val) > 2:
            output += units[int(str_val[0]) - 1]
            output += "hundred"
            if str_val[1] != 0:
                output += "and" + tens[int(str_val[1]) - 1]
                if str_val[2] != 0:
                    output += units[int(str_val[2]) - 1]
        if 3 > len(str_val) > 1:
            output += tens[int(str_val[0]) - 1]
            if str_val[1] != 0:
                output += units[int(str_val[1]) - 1]
        if 2 > len(str_val) == 1:
            output += units[int(str_val[0]) - 1]
    else:
        output = "zero"
    return output
268203
function toEnumName(value) {
  var result = '';
  var wasLower = false;
  for (var i = 0; i < value.length; i++) {
    var c = value.charAt(i);
    var isLower = /[a-z]/.test(c);
    if (!isLower && wasLower) {
      result += '_';
    }
    result += c.toUpperCase();
    wasLower = isLower;
  }
  if (!isNaN(value[0])) {
    result = '_' + result;
  }
  result = result.replace(/[^\w]/g, '_');
  result = result.replace(/_+/g, '_');
  return result;
}
1059257
def shortname(inputid):  # type: (Text) -> Text
    """"""
    parsed_id = urllib.parse.urlparse(inputid)
    if parsed_id.fragment:
        return parsed_id.fragment.split(u"/")[-1]
    return parsed_id.path.split(u"/")[-1]
1253603
protected short getShortValue() {
		if (label.equals(AbcTokens.DIGIT)
				|| label.equals(AbcTokens.DIGITS)) {
			try {
				return Short.parseShort(value);
			} catch (NumberFormatException nfe) {
				return -1;
			}
		} else
			return -1;
	}
250031
function numToIndexableString(num) {

  if (num === 0) {
    return '1';
  }

  // convert number to exponential format for easier and
  // more succinct string sorting
  var expFormat = num.toExponential().split(/e\+?/);
  var magnitude = parseInt(expFormat[1], 10);

  var neg = num < 0;

  var result = neg ? '0' : '2';

  // first sort by magnitude
  // it's easier if all magnitudes are positive
  var magForComparison = ((neg ? -magnitude : magnitude) - MIN_MAGNITUDE);
  var magString = padLeft((magForComparison).toString(), '0', MAGNITUDE_DIGITS);

  result += SEP + magString;

  // then sort by the factor
  var factor = Math.abs(parseFloat(expFormat[0])); // [1..10)
  /* istanbul ignore next */
  if (neg) { // for negative reverse ordering
    factor = 10 - factor;
  }

  var factorStr = factor.toFixed(20);

  // strip zeros from the end
  factorStr = factorStr.replace(/\.?0+$/, '');

  result += SEP + factorStr;

  return result;
}
1217806
def B012(t,i):
    
    if not i:
        return "1"
    nA = Awidth(i)
    nB = Bwidth(i)
    nBB = nB + nA
    if t < nB:
        return "0"+B012(t,i-1)
    elif t < nBB:
        return "1"+A012(t-nB,i-1)
    else:
        return "2"+B012(t-nBB,i-1)
1051038
function () {
            return [
                        __.filter (123, _.constant (456)).assert (456),
                        __.filter (['foo', 456], _.isString).assert (['foo']),
                        __.filter (['foo', 456], __.constant ('baz')).assert (['baz', 'baz']),
                        __.filter ({ foo: 123, bar: '456' }, _.isNumber).assert ({ foo: 123 })
                    ] }
643244
function(match, shortNames, longNames) {
			var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
				return [ [k, v] ];
			}).sort(function (a, b) {
				return -(a[1].length - b[1].length);
			});
			var index = -1;
			$.each(names, function (i, pair) {
				var name = pair[1];
				if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
					index = pair[0];
					iValue += name.length;
					return false;
				}
			});
			if (index != -1)
				return index + 1;
			else
				throw 'Unknown name at position ' + iValue;
		}
844276
def auto(self):
        """"""
        if self._value >= 1099511627776:
            return self.TiB, 'TiB'
        if self._value >= 1073741824:
            return self.GiB, 'GiB'
        if self._value >= 1048576:
            return self.MiB, 'MiB'
        if self._value >= 1024:
            return self.KiB, 'KiB'
        else:
            return self.B, 'B'
273155
function (n) {
            var nybHexString = '0123456789ABCDEF';
            return (
                String(nybHexString.substr((n >> 4) & 0x0F, 1)) +
                String(nybHexString.substr(n & 0x0F, 1))
            );
        }
404521
def to_s(groupsOf = 8)
      groupsOf = 8 if groupsOf == 0
      s = ""
      length.times do |i|
        s << (set?(i) ? "1" : "0")
        s << " " if i % groupsOf == 0
      end
      s
    end
669429
public static function increment_shortname($shortname) {
        global $DB;
        do {
            $matches = array();
            if (!preg_match('/(.*?)([0-9]+)$/', $shortname, $matches)) {
                $newshortname = $shortname . '_2';
            } else {
                $newshortname = $matches[1] . ($matches[2]+1);
            }
            $shortname = $newshortname;
        } while ($DB->record_exists('course', array('shortname' => $shortname)));
        return $shortname;
    }
368163
function() {
		var n = this;
		if (n<20) {
			return [
				'zero', 'one', 'two', 'three', 'four', 'five',
				'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
				'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen',
				'seventeen', 'eighteen', 'nineteen' ][n];
		} else if (n<100) {
			var tens = Math.floor(n/10);
			var ones = n%10;
			return [
				'twenty', 'thirty', 'forty', 'fifty', 'sixty',
				'seventy', 'eighty', 'ninety'
			][tens-2]+((ones>0) ? '-'+ones.toWord() : '');
		} else if (n<1000) {
			var hundreds = Math.floor(n/100);
			var tens = n%100;
			return hundreds.toWord()+' hundred and '+tens.toWord();
		}

		var places = ['thousand', 'million', 'billion', 'trillion'];
		var d   = Math.floor(new String(n).length/3);
		var pow = Math.pow(1000, d);
		var principle = Math.floor(n/pow);
		var remainder = n%pow;
		return principle.toWord()+' '+places[d-1]+' '+remainder.toWord();
	}