Increments a string that ends in a number
554894
def increment_title(title):
    
    count = re.search('\d+$', title).group(0)
    new_title = title[:-(len(count))] + str(int(count)+1)
    return new_title
1130757
function padNumber(number, length)
    {
        var result = number.toString();

        while (result.length < length)
            result = '0' + result;

        return result;
    }
869551
def increment_name(self, name, i):
        
        if i == 0:
            return name
        if '.' in name:
            split = name.split('.')
            split[-2] = split[-2] + str(i)
            return '.'.join(split)
        else:
            return name + str(i)
579226
def hms_string(secs):
    """"""
    l = hms(secs)

    def extend10(n):
        if n < 10:
            return '0' + str(n)
        else:
            return str(n)

    return extend10(l[0]) + ':' + extend10(l[1]) + ':' + extend10(l[2])
214176
function roundInt(str, precision = +Infinity) {
  if (!isNumStr(str, 10)) throw new Error('in roundInt, string must be an integer in base 10.');
  if (precision <= 0) throw new Error('in roundInt, precision must be greater than 0.');
  const minus = String.fromCharCode(consts.minus);
  
  str = rectify(str);

  // If the number is negative, ignore the negative sign for now.
  let start = (str[0] == minus) ? 1 : 0;

  // If the length of the number is less than or equal to precision, return the number.
  if (str.length - start <= precision) return str;

  // Get the significant part, the digit following, and the remaining digits.
  let sigPart = str.slice(start, precision + start);
  let nextDigit = charToVal(str[precision + start]);
  let remainder = str.slice(precision + start + 1);

  // Decide whether to increment the significant part; round half to even.
  let increment = false;
  if (nextDigit > 5) increment = true;
  else if (nextDigit == 5) {
    if (!isEntirely(remainder, consts.alphabet[0])) increment = true;  // inc if remainder is nonzero
    else {
      let lSigDigit = charToVal(sigPart[precision - 1]); // otherwise inc if it will give you an even number.
      if (lSigDigit % 2) increment = true;
    }
  }
  if (increment) sigPart = incInt(sigPart);

  // The rounded value is the significant part padded with zeros.
  let roundedLength = sigPart.length + 1 + remainder.length;
  let rounded = sigPart.padEnd(roundedLength, consts.alphabet[0]);

  // If the value was negative, replace the negative sign.
  rounded = (str[0] == minus) ? minus + rounded : rounded;

  return rounded;
}
1361882
def _stringify_number(v):
    '''
    
    '''
    if isinstance(v, (float, Decimal)):
        if math.isinf(v) and v > 0:
            v = 'Infinity'
        elif math.isinf(v) and v < 0:
            v = '-Infinity'
        else:
            v = '{:f}'.format(v)
    elif isinstance(v, BinarySize):
        v = '{:d}'.format(int(v))
    elif isinstance(v, int):
        v = '{:d}'.format(v)
    else:
        v = str(v)
    return v
47729
function increment(type, version) {
  debug(`incrementing ${version} by ${type}`);

  let [major, minor, patch] = version
    .replace('v', '')
    .split('.')
    .map((v) => parseInt(v, 10));

  if (major === 0) {
    switch (type) {
      case 'major':
        minor += 1;
        patch = 0;
        break;
      case 'minor':
        patch += 1;
        break;
      case 'patch':
        patch += 1;
        break;
      default:
        throw new Error('unrecognized change type');
    }
  }
  else {
    switch (type) {
      case 'major':
        major += 1;
        minor = 0;
        patch = 0;
        break;
      case 'minor':
        minor += 1;
        patch = 0;
        break;
      case 'patch':
        patch += 1;
        break;
      default:
        throw new Error('unrecognized change type');
    }
  }

  return `${major}.${minor}.${patch}`;
}
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;
}
1323136
def increment(self, n=1):
        
        with self.count.get_lock():
            self.count.value += n
112530
def apnumber(value):
    """"""
    try:
        value = int(value)
    except (TypeError, ValueError):
        return value
    if not 0 < value < 10:
        return str(value)
    return (_('one'), _('two'), _('three'), _('four'), _('five'), _('six'),
            _('seven'), _('eight'), _('nine'))[value - 1]
154691
function endsWithString(endingValue, valueToTest) {
  const position = valueToTest.length - endingValue.length;
  const lastIndexOfValue = valueToTest.lastIndexOf(endingValue);

  return !!~lastIndexOfValue && lastIndexOfValue === position;
}
492516
protected void increment() {

        if (m_number < 1999999999999L) {
            m_number += (long)Math.pow(1000.0, (4 - m_dots));
            setVersion(m_number);
        } else {
            throw new CmsRuntimeException(Messages.get().container(Messages.ERR_MODULE_VERSION_NUMBER_0));
        }
    }
615584
function incrementCounter() {
            for (var i = innerLen-1; i >= innerLen-4; i--) {
                inner[i]++;
                if (inner[i] <= 0xff) return;
                inner[i] = 0;
            }
        }
1123825
public String increment() {
        // filename[count].jpg
        int count = 0;
        String newFilename,
               altered = filename();
        if (altered.charAt(altered.length()-1) == RIGHT) { //(last char == 'v') we assume that a suffix already has been applied
            
            int rightBracket = altered.length()-1, 
                leftBracket  = altered.lastIndexOf(LEFT);
//              leftBracket  = rightBracket-2;// '-2' because at least one char ought to be between LEFT & RIGHT
                // crawling backwards
//              while (leftBracket > 0 && altered.charAt(leftBracket) != LEFT) leftBracket--;
            
            try {
                count = Integer.parseInt(altered.substring(leftBracket+1, rightBracket));
            } catch (NumberFormatException | IndexOutOfBoundsException ignore) {
                //if it fails, we can assume that it was not a correct suffix, so we add one now
                newFilename = altered + LEFT;
            }
            
            newFilename = altered.substring(0, leftBracket+1);
        } else {
            newFilename = altered + LEFT;
        }
        newFilename += (count+1);
        newFilename += RIGHT; // to prevent the char being added as an int
            
        updateName(newFilename);
        return newFilename + EXTENSION_SEPERATOR + ext;
    }
854726
private boolean increment(int index)
    {
        if (index == -1)
        {
            return false;
        }
        int value = current.get(index);
        if (value < max.get(index))
        {
            current.set(index, value+1);
            updateMinMax(index+1);
            return true;
        }
        boolean hasNext = increment(index-1);
        if (hasNext)
        {
            current.set(index, min.get(index));            
        }
        return hasNext;
    }
1093460
public static int cint(String str)
    {
        if (str != null)
            try
            {
                int i = new Integer(str).intValue();
                return i;
            }
            catch (NumberFormatException e)
            {

            }

        return -1;
    }
1343538
function toFixedNumber (str, digits) {
  if (digits) {
    return stringToNumber(('' + stringToNumber(str)).replace(new RegExp('(\\d+.\\d{0,' + digits + '}).*'), '$1'))
  }
  return stringToInteger(str)
}