Trims zeros and decimal points.
494941
def _trim_front(strings):
    
    trimmed = strings
    while len(strings) > 0 and all(x[0] == ' ' for x in trimmed):
        trimmed = [x[1:] for x in trimmed]
    return trimmed
1214423
def trim_data(xmin, xmax, xdata, *args):
    

    # make sure it's a numpy array
    if not isinstance(xdata, _n.ndarray): xdata = _n.array(xdata)

    # make sure xmin and xmax are numbers
    if xmin is None: xmin = min(xdata)
    if xmax is None: xmax = max(xdata)

    # get all the indices satisfying the trim condition
    ns = _n.argwhere((xdata >= xmin) & (xdata <= xmax)).transpose()[0]

    # trim the xdata
    output = []
    output.append(xdata[ns])

    # trim the rest
    for a in args:
        # make sure it's a numpy array
        if not isinstance(a, _n.ndarray): a = _n.array(a)
        output.append(a[ns])

    return output
381167
def floats(s):
    """"""
    try:
        return float(s)
    except ValueError:
        s = re.sub(r'(\d)\s*\(\d+(\.\d+)?\)', r'\1', s)        # Remove bracketed numbers from end
        s = re.sub(r'(\d)\s*±\s*\d+(\.\d+)?', r'\1', s)        # Remove uncertainties from end
        s = s.rstrip('\'"+-=<>/,.:;!?)]}…∼~≈×*_≥≤')             # Remove trailing punctuation
        s = s.lstrip('\'"+=<>/([{∼~≈×*_≥≤£$€#§')                # Remove leading punctuation
        s = s.replace(',', '')                                 # Remove commas
        s = ''.join(s.split())                                  # Strip whitespace
        s = re.sub(r'(\d)\s*[×x]\s*10\^?(-?\d)', r'\1e\2', s)  # Convert scientific notation
        return float(s)
1287457
private synchronized void trim() {
        while (mCurrentSize > mSizeLimit) {
            byte[] buf = mBuffersByLastUse.remove(0);
            mBuffersBySize.remove(buf);
            mCurrentSize -= buf.length;
        }
    }
571722
def drop_trailing_zeros_decimal(num):
    
    out = str(num)
    return out.rstrip('0').rstrip('.') if '.' in out else out
1162155
function trim(text) {
  var MAX_INDENT = 9999;
  var empty = RegExp.prototype.test.bind(/^\s*$/);
  var lines = text.split('\n');
  var minIndent = MAX_INDENT;
  var indentRegExp;
  var ignoreLine = (lines[0][0] != ' '  && lines.length > 1);
  // ignore first line if it has no indentation and there is more than one line

  lines.forEach(function(line){
    if (ignoreLine) {
      ignoreLine = false;
      return;
    }

    var indent = line.match(/^\s*/)[0].length;
    if (indent > 0 || minIndent == MAX_INDENT) {
      minIndent = Math.min(minIndent, indent);
    }
  });

  indentRegExp = new RegExp('^\\s{0,' + minIndent + '}');

  for ( var i = 0; i < lines.length; i++) {
    lines[i] = lines[i].replace(indentRegExp, '');
  }

  // remove leading lines
  while (empty(lines[0])) {
    lines.shift();
  }

  // remove trailing
  while (empty(lines[lines.length - 1])) {
    lines.pop();
  }
  return lines.join('\n');
}
1318801
private void clearUnusedPrecision() {
        switch (_precision) {
            case YEAR:
                _month = 1;
            case MONTH:
                _day = 1;
            case DAY:
                _hour = 0;
                _minute = 0;
            case MINUTE:
                _second = 0;
                _fraction = null;
            case SECOND:
        }
    }
715335
def trimmed(self,thresh=0.1):
        
        for start in range(0,self.width-1):
            if self.bits[start]>=thresh: break
        for stop  in range(self.width,1,-1):
            if self.bits[stop-1]>=thresh: break
        m = self[start,stop]
        return m
424733
function roundToPrecision(numStr, scale, fixedDecimalScale) {
  //if number is empty don't do anything return empty string
  if (['', '-'].indexOf(numStr) !== -1) return numStr;
  var shoudHaveDecimalSeparator = numStr.indexOf('.') !== -1 && scale;

  var _splitDecimal = splitDecimal(numStr),
      beforeDecimal = _splitDecimal.beforeDecimal,
      afterDecimal = _splitDecimal.afterDecimal,
      hasNagation = _splitDecimal.hasNagation;

  var roundedDecimalParts = parseFloat("0.".concat(afterDecimal || '0')).toFixed(scale).split('.');
  var intPart = beforeDecimal.split('').reverse().reduce(function (roundedStr, current, idx) {
    if (roundedStr.length > idx) {
      return (Number(roundedStr[0]) + Number(current)).toString() + roundedStr.substring(1, roundedStr.length);
    }

    return current + roundedStr;
  }, roundedDecimalParts[0]);
  var decimalPart = limitToScale(roundedDecimalParts[1] || '', Math.min(scale, afterDecimal.length), fixedDecimalScale);
  var negation = hasNagation ? '-' : '';
  var decimalSeparator = shoudHaveDecimalSeparator ? '.' : '';
  return "".concat(negation).concat(intPart).concat(decimalSeparator).concat(decimalPart);
}
223041
function removeLeadingZeros(str) {
  if (typeof str != 'string') throw new Error('in removeLeadingZeros, data type mismatch');

  let iNonZero = -1;
  for (let i = 0; i < str.length; i++) {
    if (charToVal(str[i]) != 0) {
      iNonZero = i; // index of the first nonzero digit
      break;
    }
  }
  if (iNonZero > 0) str = str.slice(iNonZero);
  if (iNonZero < 0) return ''; // if 'str' is entirely zeros or is the empty string
    
  return str;
}
1282140
def trim(lines):
    
    trim_top = None
    trim_bottom = None
    _lines = lines[:]

    for (lineno, line) in enumerate(_lines):
        if hasattr(line, 'is_text_line') and line.is_text_line and not line.text.strip():
            trim_top = lineno
        else:
            break

    for (lineno, line) in enumerate(reversed(_lines)):
        if hasattr(line, 'is_text_line') and line.is_text_line and not line.text.strip():
            trim_bottom = lineno
        else:
            break

    if trim_top is not None:
        _lines = _lines[trim_top + 1:]

    if trim_bottom is not None:
        trim_bottom = len(_lines) - trim_bottom - 1
        _lines = _lines[:trim_bottom]

    return _lines
754465
def trim_data(x):
    
    # Find indices for first and last valid data
    first = 0
    while np.isnan(x[first]):
        first += 1
    last = len(x)
    while np.isnan(x[last - 1]):
        last -= 1
    return x[first:last]
565882
public static function trim($n)
    {
        $float         = floatval($n);
        $decimalPlaces = 0;

        // If the number rounded to $decimalPlaces isn't equal to the float val, add another decimal place and try again
        while ($float != round($float, $decimalPlaces)) {
            $decimalPlaces++;
        }

        $decimalPlaces = ($decimalPlaces < 2) ? 2 : $decimalPlaces;

        return number_format($float, $decimalPlaces, ".", "");
    }
1278426
public static Slice trim(Slice utf8, int[] whiteSpaceCodePoints)
    {
        int start = firstNonMatchPosition(utf8, whiteSpaceCodePoints);
        int end = lastNonMatchPosition(utf8, start, whiteSpaceCodePoints);
        return utf8.slice(start, end - start);
    }
901243
def truncate_to_string(num, precision=0):
        """"""
        if precision > 0:
            parts = ('{0:.%df}' % precision).format(Decimal(num)).split('.')
            decimal_digits = parts[1][:precision].rstrip('0')
            decimal_digits = decimal_digits if len(decimal_digits) else '0'
            return parts[0] + '.' + decimal_digits
        return ('%d' % num)
99361
def _delete(self, bits, pos):
        """"""
        assert 0 <= pos <= self.len
        assert pos + bits <= self.len
        if not pos:
            # Cutting bits off at the start.
            self._truncatestart(bits)
            return
        if pos + bits == self.len:
            # Cutting bits off at the end.
            self._truncateend(bits)
            return
        if pos > self.len - pos - bits:
            # More bits before cut point than after it, so do bit shifting
            # on the final bits.
            end = self._slice(pos + bits, self.len)
            assert self.len - pos > 0
            self._truncateend(self.len - pos)
            self._append(end)
            return
        # More bits after the cut point than before it.
        start = self._slice(0, pos)
        self._truncatestart(pos + bits)
        self._prepend(start)
        return
1257710
def trimLeft(self, amount):
    
    if amount == 0:
      return
    self.sequenceData = self.sequenceData[amount:]
    self.sequenceQual = self.sequenceQual[amount:]