Formats the given credit card number with dashes.

@param string credit card number
@return string
192075
static function FormatWithDashes($cc_num)
	{
		$dashSeparatedNumber = "";

		if(strlen($cc_num) == 15)
		{
			$firstFour = substr($cc_num,0,4);
			$secondSix = substr($cc_num,4,6);
			$thirdFive = substr($cc_num,10,5);
			$dashSeparatedNumber = $firstFour . "-" . $secondSix . "-" . $thirdFive;
		}
		else
		{
			$firstFour = substr($cc_num,0,4);
			$secondFour = substr($cc_num,4,4);
			$thirdFour = substr($cc_num,8,4);
			$fourthFour = substr($cc_num,12,4);
			$dashSeparatedNumber = $firstFour . "-" . $secondFour . "-" . $thirdFour . "-" . $fourthFour;
		}

		return $dashSeparatedNumber;
	}
755812
public function format(Card $card)
    {
        $tags = [];
        
        $name = $card->getName();
        $fullName = $card->getFullName();
        if ($name !== null) {
            $tags[] = '<dt>Name</dt><dd><span class="p-name">' . $this->nameFormatter->format($name) . '</span></dd>';
        } elseif (strlen($fullName) > 0) {
            $tags[] = '<dt>Name</dt><dd><span class="p-name">' . htmlspecialchars($fullName) . '</span></dd>';
        }
        
        $photo = $card->getPhoto();
        if ($photo !== null) {
            $tags[] = '<dt>Photo</dt><dd><img class="u-photo" src="' . htmlspecialchars($photo) . '" alt="Photo" /></dd></span>';
        }
        $logo = $card->getLogo();
        if ($logo !== null) {
            $tags[] = '<dt>Logo</dt><dd><img class="u-logo" src="' . htmlspecialchars($logo) . '" alt="Logo" /></dd></span>';
        }
        
        $address = $card->getAddress();
        if ($address !== null) {
            $tags[] = '<dt>Address</dt><dd class="p-adr">' . $this->addressFormatter->format($address) . '</dd>';
        }
        
        $tel = $card->getTel();
        if (strlen($tel) > 0) {
            $tags[] = '<dt>Phone</dt><dd><a href="tel:' . preg_replace('/[^0-9\+]/', '', $tel) . '" class="p-tel">' . htmlspecialchars($tel) .  '</a></dd>';
        }
        
        $email = $card->getEmail();
        if (strlen($email) > 0) {
            $tags[] = '<dt>Email</dt><dd><a href="mailto:' . htmlspecialchars($email) . '" class="u-email">' . htmlspecialchars($email) . '</a></dd>';
        }

        $url = $card->getUrl();
        if (strlen($url) > 0) {
            $tags[] = '<dt>Homepage</dt><dd><a href="' . htmlspecialchars($url) . '" class="u-url>' . htmlspecialchars($url) . '</a></dd>';
        }
        
        $impp = $card->getImpp();
        if (strlen($impp) > 0) {
            $tags[] = '<dt>IMPP</dt><dd><a href="' . htmlspecialchars($impp) . '" class="u-impp">' . htmlspecialchars($impp) . '</a></dd>';
        }
        
        $org = $card->getOrg();
        $orgName = $card->getOrgName();
        if ($org !== null) {
            $tags[] = '<dt>Organization</dt><dd class="p-org">' . $this->format($org) . '</dd>';
        } elseif (strlen($orgName) > 0) {
            $tags[] = '<dt>Organization</dt><dd><span class="p-org p-organization-name">' . htmlspecialchars($orgName) . '</span></dd>';
        }
        
        $title = $card->getTitle();
        if (strlen($title) > 0) {
            $tags[] = '<dt>Title</dt><dd><span class="p-job-title">' . htmlspecialchars($title) . '</span></dd>';
        }
        
        $role = $card->getRole();
        if (strlen($role) > 0) {
            $tags[] = '<dt>Role</dt><dd><span class="p-role">' . htmlspecialchars($role) . '</span></dd>';
        }
        
        $sex = $card->getSex();
        if (strlen($sex) > 0) {
            $tags[] = '<dt>Sex</dt><dd><span class="p-sex">' . htmlspecialchars($role) . '</span></dd>';
        }
        
        $gender = $card->getGender();
        if (strlen($gender) > 0) {
            $tags[] = '<dt>Gender</dt><dd><span class="p-gender">' . htmlspecialchars($gender) . '</span></dd>';
        }
        
        $birthday = $card->getBirthday();
        if ($birthday !== null) {
            $tags[] = '<dt>Birthday</dt><dd><time class="dt-bday" datetime="' . $birthday->format('Y-m-d') . '">' . $birthday->format('F j, Y') . '</time></dd>';
        }
        
        $anniversary = $card->getAnniversary();
        if ($anniversary !== null) {
            $tags[] = '<dt>Anniversary</dt><dd><time class="dt-anniversary" datetime="' . $anniversary->format('Y-m-d') . '">' . $anniversary->format('F j, Y') . '</time></dd>';
        }
        
        $key = $card->getKey();
        if (strlen($key) > 0) {
            $tags[] = '<dt>Public Key</dt><dd><span class="u-key">' . htmlspecialchars($key) . '</span></dd>';
        }

        $category = $card->getCategory();
        if (strlen($category) > 0) {
            $tags[] = '<dt>Category</dt><dd><span class="p-category">' . htmlspecialchars($category) . '</span></dd>';
        }
        
        $note = $card->getNote();
        if (strlen($note) > 0) {
            $tags[] = '<dt>Note</dt><dd><div class="p-note">' . htmlspecialchars($note) . '</div></dd>';
        }

        return '<dl class="h-card">' . implode(' ', $tags) . '</dl>';
    }
1228365
def FormatAsHexString(num, width=None, prefix="0x"):
  """"""
  # Strip "0x".
  hex_str = hex(num)[2:]
  # Strip "L" for long values.
  hex_str = hex_str.replace("L", "")
  if width:
    hex_str = hex_str.rjust(width, "0")
  return "%s%s" % (prefix, hex_str)
1349020
static function format_fingerprint($fingerprint)
    {
        if (!$fingerprint) {
            return '';
        }

        $result = '';
        for ($i=0; $i<40; $i++) {
            if ($i % 4 == 0) {
                $result .= ' ';
            }
            $result .= $fingerprint[$i];
        }

        return $result;
    }
265322
public static function formatSocialNumber($number){

		assert('is_integer($number)');

		if(!is_integer($number)) return $number;

		if($number > 10000000){

			$number = round($number / 1000000) . 'M';
		}
		elseif($number > 1000000){

			$number = round($number / 1000000, 1) . 'M';
		}
		elseif($number > 10000){

			$number = round($number / 1000) . 'K';
		}
		elseif($number > 1000){

			$number = round($number / 1000, 1) . 'K';
		}

		return $number;
	}
95762
public function format($number) {
    if ((float) $number != $number) {
      throw new \InvalidArgumentException('Number has no valid float value.');
    }
    $sign = (int) ($number < 0);

    // Split the number in major and minor units, and make sure there is a
    // minor unit at all.
    $number = explode('.', abs($number));
    $number += array(
      self::MINOR => '',
    );

    $digits = array(
      str_split($number[self::MAJOR]),
      strlen($number[self::MINOR]) ? str_split($number[self::MINOR]) : array(),
    );

    $symbols = $this->cloneNumberPatternSymbols($this->symbols[$sign]);
    $this->process($symbols[$sign][self::MAJOR], $digits[self::MAJOR]);
    // Integer formatting defaults from right to left, but minor units should
    // be formatted from left to right, so reverse all data and results.
    $symbols_minor = array_reverse($symbols[$sign][self::MINOR]);
    $this->process($symbols_minor, array_reverse($digits[self::MINOR]));
    foreach ($symbols[$sign][self::MINOR] as $symbol) {
      if (!is_null($symbol->replacement)) {
        $symbol->replacement = strrev($symbol->replacement);
      }
    }

    // Prepare the output string.
    $output = array(
      self::MAJOR => '',
      self::MINOR => '',
    );
    foreach ($symbols[$sign] as $fragment => $fragment_symbols) {
      $this->replacePlaceholders($fragment_symbols);
      foreach ($fragment_symbols as $symbol) {
        $output[$fragment] .= !is_null($symbol->replacement) ? $symbol->replacement : $symbol->symbol;
      }
    }

    return $output[self::MAJOR] . $this->getReplacement(self::SYMBOL_SPECIAL_DECIMAL_SEPARATOR) . $output[self::MINOR];
  }
953526
function formatNumber$1(value, locale, style, digitsInfo, currency) {
    if (currency === void 0) { currency = null; }
    var /** @type {?} */ res = { str: null };
    var /** @type {?} */ format = getLocaleNumberFormat(locale, style);
    var /** @type {?} */ num;
    // Convert strings to numbers
    if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) {
        num = +value;
    }
    else if (typeof value !== 'number') {
        res.error = value + " is not a number";
        return res;
    }
    else {
        num = value;
    }
    if (style === NumberFormatStyle.Percent) {
        num = num * 100;
    }
    var /** @type {?} */ numStr = Math.abs(num) + '';
    var /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
    var /** @type {?} */ formattedText = '';
    var /** @type {?} */ isZero = false;
    if (!isFinite(num)) {
        formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
    }
    else {
        var /** @type {?} */ parsedNumber = parseNumber(numStr);
        var /** @type {?} */ minInt = pattern.minInt;
        var /** @type {?} */ minFraction = pattern.minFrac;
        var /** @type {?} */ maxFraction = pattern.maxFrac;
        if (digitsInfo) {
            var /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
            if (parts === null) {
                res.error = digitsInfo + " is not a valid digit info";
                return res;
            }
            var /** @type {?} */ minIntPart = parts[1];
            var /** @type {?} */ minFractionPart = parts[3];
            var /** @type {?} */ maxFractionPart = parts[5];
            if (minIntPart != null) {
                minInt = parseIntAutoRadix(minIntPart);
            }
            if (minFractionPart != null) {
                minFraction = parseIntAutoRadix(minFractionPart);
            }
            if (maxFractionPart != null) {
                maxFraction = parseIntAutoRadix(maxFractionPart);
            }
            else if (minFractionPart != null && minFraction > maxFraction) {
                maxFraction = minFraction;
            }
        }
        roundNumber(parsedNumber, minFraction, maxFraction);
        var /** @type {?} */ digits = parsedNumber.digits;
        var /** @type {?} */ integerLen = parsedNumber.integerLen;
        var /** @type {?} */ exponent = parsedNumber.exponent;
        var /** @type {?} */ decimals = [];
        isZero = digits.every(function (d) { return !d; });
        // pad zeros for small numbers
        for (; integerLen < minInt; integerLen++) {
            digits.unshift(0);
        }
        // pad zeros for small numbers
        for (; integerLen < 0; integerLen++) {
            digits.unshift(0);
        }
        // extract decimals digits
        if (integerLen > 0) {
            decimals = digits.splice(integerLen, digits.length);
        }
        else {
            decimals = digits;
            digits = [0];
        }
        // format the integer digits with grouping separators
        var /** @type {?} */ groups = [];
        if (digits.length >= pattern.lgSize) {
            groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
        }
        while (digits.length > pattern.gSize) {
            groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
        }
        if (digits.length) {
            groups.unshift(digits.join(''));
        }
        var /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group;
        formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
        // append the decimal digits
        if (decimals.length) {
            var /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal;
            formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
        }
        if (exponent) {
            formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
        }
    }
    if (num < 0 && !isZero) {
        formattedText = pattern.negPre + formattedText + pattern.negSuf;
    }
    else {
        formattedText = pattern.posPre + formattedText + pattern.posSuf;
    }
    if (style === NumberFormatStyle.Currency && currency !== null) {
        res.str = formattedText
            .replace(CURRENCY_CHAR, currency)
            .replace(CURRENCY_CHAR, '');
        return res;
    }
    if (style === NumberFormatStyle.Percent) {
        res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
        return res;
    }
    res.str = formattedText;
    return res;
}
920516
public function format($number, ArrayObject $row = null): string
    {
        $locale = $this->params['locale'];
        //$formatterId = md5($locale);
        $formatterId = $locale . (string) $this->params['pattern'];
        if (!array_key_exists($formatterId, $this->formatters)) {
            $this->loadFormatterId($formatterId);
        }

        if (!is_numeric($number)) {
            $this->throwNumberFormatterException($this->formatters[$formatterId], $number);
        }

        return $this->formatters[$formatterId]->format($number);
    }
1186382
public function numberFormat($decimals = 0, $thousandSeparator = '.', $decimalSeparator = ',')
    {
        $decimalSeparator = $thousandSeparator === '.' ? ',' : '.';

        return number_format($this->amount, $decimals, $decimalSeparator, $thousandSeparator);
    }
997387
public static function format($phone)
    {
        // Since we are a US-based application, we want to strip the "+1" US country code to facilitate formatting below
        if (substr($phone, 0, 3) == '+1 ') {
            $phone = str_replace('+1 ', '', $phone);
        }

        // US numbers will have 10 digits. Otherwise, leave alone.
        if (preg_match_all('/[0-9]/', $phone) == 10) {
            $phone = preg_replace('/[^0-9]/', '', $phone);
            $phone = '(' . substr($phone, 0, 3) . ') ' . substr($phone, 3, 3) . '-' . substr($phone, 6);
        }

        // Empty phone values should be made null
        if (empty($phone)) {
            $phone = null;
        }

        return $phone;
    }
1068175
public static function format($value)
    {
        if (isset($value['priority'])) {
            $value['priority'] = QuantityFormatter::format($value['priority']);
        }
        if (isset($value['ttl'])) {
            $value['ttl'] = QuantityFormatter::format($value['ttl']);
        }
        return $value;
    }
652736
public function format($value): string
    {
        $value = $value->rate();

        if ($value instanceof PercentageDiscount) {
            return (new PercentFormatter($value))->format($value);
        }

        if ($value instanceof ValueDiscount) {
            return (new MoneyFormatter())->format($value);
        }
    }
757260
public static function formatColumnName($number)
    {
        for ($char = ''; $number >= 0; $number = (int) ($number / 26) - 1) {
            $char = \chr($number % 26 + 0x41) . $char;
        }

        return $char;
    }
1263180
public function format()
    {
        $negative = $this->isNegative();
        $value = $this->getValue();
        $amount = $negative ? -$value : $value;
        $thousands = $this->currency->getThousandsSeparator();
        $decimals = $this->currency->getDecimalMark();
        $prefix = $this->currency->getPrefix();
        $suffix = $this->currency->getSuffix();
        $value = number_format($amount, $this->currency->getPrecision(), $decimals, $thousands);

        return ($negative ? '-' : '') . $prefix . $value . $suffix;
    }
38972
public function formatAmount($amount, $currency = null)
    {
        return str_replace('.00', '', $this->moneyHelper->formatAmount($amount, $currency));
    }
1288457
public static function _format($number, array $formatOptions = []) {
		if (!is_numeric($number)) {
			$default = '---';
			if (!empty($options['default'])) {
				$default = $options['default'];
			}
			return $default;
		}
		if ($formatOptions === false) {
			$formatOptions = [];
		} elseif (!is_array($formatOptions)) {
			$formatOptions = ['places' => $formatOptions];
		}
		$options = ['before' => '', 'after' => '', 'places' => 2, 'thousands' => static::$_thousands, 'decimals' => static::$_decimals, 'escape' => false];
		$options = $formatOptions + $options;

		if (!empty($options['currency'])) {
			if (!empty(static::$_symbolRight)) {
				$options['after'] = ' ' . static::$_symbolRight;
			} elseif (!empty(static::$_symbolLeft)) {
				$options['before'] = static::$_symbolLeft . ' ';
			}
		}

		/*
		if ($spacer !== false) {
			$spacer = ($spacer === true) ? ' ' : $spacer;
			if ((string)$before !== '') {
				$before .= $spacer;
			}
			if ((string)$after !== '') {
				$after = $spacer . $after;
			}
		}

		*/
		if ($options['places'] < 0) {
			$number = round($number, $options['places']);
		}
		$sign = '';
		if ($number > 0 && !empty($options['signed'])) {
			$sign = '+';
		}
		if (isset($options['signed'])) {
			unset($options['signed']);
		}
		return $sign . parent::format($number, $options);
	}
1073128
public function format($value)
    {
        $formatter = new NumberFormatter($this->locale(), NumberFormatter::CURRENCY);

        $code = $this->code($value);
        $divisor = $this->divisor($code);
        $amount = $this->convert($value, $divisor);

        return $formatter->formatCurrency($amount, $code);
    }