Attempts to set the formatting template and returns a string which
        contains the formatted version of the digits entered so far.
3805
def _attempt_to_choose_formatting_pattern(self):
        """"""
        # We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
        # number (excluding national prefix) have been entered.
        if len(self._national_number) >= _MIN_LEADING_DIGITS_LENGTH:
            self._get_available_formats(self._national_number)
            # See if the accrued digits can be formatted properly already.
            formatted_number = self._attempt_to_format_accrued_digits()
            if len(formatted_number) > 0:
                return formatted_number
            if self._maybe_create_new_template():
                return self._input_accrued_national_number()
            else:
                return self._accrued_input
        else:
            return self._append_national_number(self._national_number)
852877
static String zeroPrepend(long num, int digits) {
		String numStr = Long.toString(num);
		if (numStr.length() >= digits) {
			return numStr;
		} else {
			return String.format("%0" + digits + "d", num);
		}
	}
1221186
def print_setting(self) -> str:
        
        ret = "\n"
        ret += "==================== Setting of {} ============================\n".format(self.configuration['name'])
        ret += "{}".format(self.setting)
        ret += "===============================================================\n"
        ret += "{}".format(self._var_form.setting)
        ret += "===============================================================\n"
        return ret
1165989
private Supplier getFormatterForType(String type) {
    switch(type) {
      case "s":           //string stored in shared table
        if (!lastContents.isEmpty()) {
            int idx = Integer.parseInt(lastContents);
            return new StringSupplier(new XSSFRichTextString(sst.getEntryAt(idx)).toString());
        }
        return new StringSupplier(lastContents);
      case "inlineStr":   //inline string (not in sst)
      case "str":
        return new StringSupplier(new XSSFRichTextString(lastContents).toString());
      case "e":           //error type
        return new StringSupplier("ERROR:  " + lastContents);
      case "n":           //numeric type
        if(currentCell.getNumericFormat() != null && lastContents.length() > 0) {
          // the formatRawCellContents operation incurs a significant overhead on large sheets,
          // and we want to defer the execution of this method until the value is actually needed.
          // it is not needed in all cases..
          final String currentLastContents = lastContents;
          final int currentNumericFormatIndex = currentCell.getNumericFormatIndex();
          final String currentNumericFormat = currentCell.getNumericFormat();

          return new Supplier() {
            String cachedContent;

            @Override
            public Object getContent() {
              if (cachedContent == null) {
                cachedContent = dataFormatter.formatRawCellContents(
                        Double.parseDouble(currentLastContents),
                        currentNumericFormatIndex,
                        currentNumericFormat);
              }

              return cachedContent;
            }
          };
        } else {
          return new StringSupplier(lastContents);
        }
      default:
        return new StringSupplier(lastContents);
    }
  }
618933
String getFormatted() {
        StringBuilder str = new StringBuilder();
        str.append(this.propertyName);
        str.append(this.valueComparator.getComparatorString());
        if (this.value != null) {
            str.append(this.value.getFormatted());
        } else {
            str.append("null");
        }
        return str.toString();
    }
1054187
def get_value_format(value_format: Union[Callable, str] = str) -> Callable[[float], str]:
    
    if value_format is None:
        value_format = ""
    if isinstance(value_format, str):
        format_str = "{0:" + value_format + "}"

        def value_format(x): return format_str.format(x)

    return value_format
797404
function getFormattedValue(value) {
            let format;

            if (isInteger(value)) {
                format = formatIntegerValue;
            } else {
                format = formatDecimalValue;
            }

            return format(value);
        }
1293838
private function getFormattedValue(): string
    {
        return (string) is_numeric($this->value) ?
            $this->value :
            sprintf('"%s"', $this->value);
    }
1238029
private static String intToString(int value, int digit) {
        StringBuilder stringBuilder = new StringBuilder(digit);
        stringBuilder.append(Integer.toString(value));
        while (stringBuilder.length() < digit) {
            stringBuilder.insert(0, "0");
        }
        return stringBuilder.toString();
    }
835321
def format(target)
      begin
        number = number_with_precision(target, @precision)
        parts = number.split('.')
        if parts.at(1).nil?
          parts[0] + "%"
        else
          parts[0] + @separator + parts[1].to_s + "%"
        end
      rescue
        target
      end
    end
1086843
def formatted_version
        stringified = @version.to_s
        return stringified unless stringified.length == 14
        stringified.insert(4, "_").insert(7, "_").insert(10, "_")
      end
575531
@SuppressWarnings("squid:S3655")
    public String getNummerFormatted() {
        if (!this.getNummer().isPresent()) {
            throw new IllegalStateException("no number present");
        }
        BigInteger hundert = BigInteger.valueOf(100);
        StringBuilder formatted = new StringBuilder();
        for (BigInteger i = this.getNummer().get(); i.compareTo(BigInteger.ONE) > 0; i = i.divide(hundert)) {
            formatted.insert(0, " " + i.remainder(hundert));
        }
        return formatted.toString().trim();
    }
393266
def get_template(filename_or_string, is_string=False):
    '''
    
    '''

    # Cache against string sha or just the filename
    cache_key = sha1_hash(filename_or_string) if is_string else filename_or_string

    if cache_key in TEMPLATES:
        return TEMPLATES[cache_key]

    if is_string:
        # Set the input string as our template
        template_string = filename_or_string

    else:
        # Load template data into memory
        with open(filename_or_string, 'r') as file_io:
            template_string = file_io.read()

    TEMPLATES[cache_key] = Template(template_string, keep_trailing_newline=True)
    return TEMPLATES[cache_key]
573142
def pformat(self):
        '''
        
        '''
        result = "{\n"
        indent1 = " " * 4
        indent2 = " " * 8
        for line_no, code_objects in sorted(self.items()):
            result += '%s%i: [\n' % (indent1, line_no)
            for code_object in code_objects:
                result += '%s"""<%s:%s>""",\n' % (
                    indent2, code_object.PART_TYPE, code_object.content
                )
            result += '%s],\n' % indent1
        result += "}"

        return result
986966
public static void format(
      BigDecimal n,
      DigitBuffer buf,
      NumberFormatterParams params,
      boolean currencyMode,
      boolean grouping,
      int minIntDigits,
      int primaryGroupingSize,
      int secondaryGroupingSize) {

    // Setup integer digit grouping.
    if (secondaryGroupingSize <= 0) {
      secondaryGroupingSize = primaryGroupingSize;
    }

    // Check if we need to perform digit grouping.
    int groupSize = primaryGroupingSize;
    boolean shouldGroup = false;

    // Output as many integer digits as are available, unless minIntDigits == 0
    // and our value is < 1.
    long intDigits = integerDigits(n);
    if (minIntDigits == 0 && n.compareTo(BigDecimal.ONE) == -1) {
      intDigits = 0;
    } else {
      intDigits = Math.max(intDigits, minIntDigits);
    }

    if (grouping) {
      if (primaryGroupingSize > 0) {
        shouldGroup = intDigits >= (params.minimumGroupingDigits + primaryGroupingSize);
      }
    }

    // Select the decimal and grouping characters.
    String decimal = currencyMode ? params.currencyDecimal : params.decimal;
    String group = currencyMode ? params.currencyGroup : params.group;

    // Keep a pointer to the end of the buffer, since we render the formatted number
    // in reverse to be a bit more compact.
    int bufferStart = buf.length();

    // We only emit the absolute value of the number, since the indication of
    // negative numbers is pattern and locale-specific.
    if (n.signum() == -1) {
      n = n.negate();
    }

    // Translate the standard decimal representation into the localized form.
    // At this point the number of integer and decimal digits is set, all we're
    // doing is outputting the correct decimal symbol and grouping symbols.

    String s = n.toPlainString();
    int end = s.length() - 1;

    // Emit decimal digits and decimal point.
    int idx = s.lastIndexOf('.');
    if (idx != -1) {
      while (end > idx) {
        buf.append(s.charAt(end));
        end--;
      }

      end--;
      buf.append(decimal);
    }

    // Emit integer part with optional grouping
    int emitted = 0;
    while (intDigits > 0 && end >= 0) {
      // Emit grouping digits.
      if (shouldGroup) {
        boolean emit = emitted > 0 && emitted % groupSize == 0;
        if (emit) {
          // Append a grouping character and switch to the secondary grouping size
          buf.append(group);
          emitted -= groupSize;
          groupSize = secondaryGroupingSize;
        }
      }
      buf.append(s.charAt(end));
      end--;
      emitted++;
      intDigits--;
    }

    // Emit zeroes to pad integer part with optional grouping
    if (intDigits > 0) {
      for (int i = 0; i < intDigits; i++) {
        // Emit grouping digits.
        if (shouldGroup) {
          boolean emit = emitted > 0 && emitted % groupSize == 0;
          if (emit) {
            // Append a grouping character and switch to the secondary grouping size
            buf.append(group);
            emitted -= groupSize;
            groupSize = secondaryGroupingSize;
          }
        }
        buf.append('0');
        emitted++;
      }
    }

    buf.reverse(bufferStart);
  }
823488
private function attemptToChooseFormattingPattern()
    {
        // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
        // number (excluding national prefix) have been entered.
        if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) {
            $this->getAvailableFormats($this->nationalNumber);
            // See if the accrued digits can be formatted properly already.
            $formattedNumber = $this->attemptToFormatAccruedDigits();
            if (mb_strlen($formattedNumber) > 0) {
                return $formattedNumber;
            }
            return $this->maybeCreateNewTemplate() ? $this->inputAccruedNationalNumber() : $this->accruedInput;
        }

        return $this->appendNationalNumber($this->nationalNumber);
    }
257303
def tick(self):
        """"""
        string = self.passed
        if self.rounding:
            string = round(string)
        if self.readable:
            string = self.readable(string)
        return string