Adds wrappers of the form "{0} {1}" for wrapping a formatted number with a
prefix or suffix.
546516
private void addUnitWrappers(TypeSpec.Builder type, NumberData data) {
    MethodSpec.Builder method = MethodSpec.methodBuilder("wrapUnits")
        .addModifiers(PROTECTED)
        .addParameter(PluralCategory.class, "category")
        .addParameter(DigitBuffer.class, "dbuf")
        .addParameter(String.class, "unit")
        .addParameter(StringBuilder.class, "dest");
    
    
    List<String> patterns = new ArrayList<>(new HashSet<>(data.currencyUnitPattern.values()));
    if (patterns.size() == 1) {
      // Short cut if all patterns are the same.
      List<Node> nodes = WRAPPER_PARSER.parseWrapper(patterns.get(0));
      for (Node node : nodes) {
        if (node instanceof Field) {
          Field field = (Field)node;
          if (field.ch() == '0') {
            method.addStatement("dbuf.appendTo(dest)");
          } else {
            method.addStatement("dest.append(unit)");
          }
        } else if (node instanceof Text) {
          method.addStatement("dest.append($S)", ((Text)node).text());
        }
      }
    } else {
      method.beginControlFlow("switch (category)");
      for (Map.Entry<String, String> entry : data.currencyUnitPattern.entrySet()) {
        String[] parts = entry.getKey().split("-");
        PluralCategory category = PluralCategory.fromString(parts[2]);
        String pattern = entry.getValue();
        List<Node> nodes = WRAPPER_PARSER.parseWrapper(pattern);
        if (category != PluralCategory.OTHER) {
          method.beginControlFlow("case $L:", category);
        } else {
          method.beginControlFlow("case $L:\ndefault:", category);
        }
        for (Node node : nodes) {
          if (node instanceof Field) {
            Field field = (Field)node;
            if (field.ch() == '0') {
              method.addStatement("dbuf.appendTo(dest)");
            } else {
              method.addStatement("dest.append(unit)");
            }
          } else if (node instanceof Text) {
            method.addStatement("dest.append($S)", ((Text)node).text());
          }
        }
        method.addStatement("break");
        method.endControlFlow();
      }
      method.endControlFlow();
    }
    
    type.addMethod(method.build());
  }
659323
function formatFrom ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {

		var originalInput = input, inputIsNegative, output = '';

		// User defined pre-decoder. Result must be a non empty string.
		if ( undo ) {
			input = undo(input);
		}

		// Test the input. Can't be empty.
		if ( !input || typeof input !== 'string' ) {
			return false;
		}

		// If the string starts with the negativeBefore value: remove it.
		// Remember is was there, the number is negative.
		if ( negativeBefore && strStartsWith(input, negativeBefore) ) {
			input = input.replace(negativeBefore, '');
			inputIsNegative = true;
		}

		// Repeat the same procedure for the prefix.
		if ( prefix && strStartsWith(input, prefix) ) {
			input = input.replace(prefix, '');
		}

		// And again for negative.
		if ( negative && strStartsWith(input, negative) ) {
			input = input.replace(negative, '');
			inputIsNegative = true;
		}

		// Remove the postfix.
		// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
		if ( postfix && strEndsWith(input, postfix) ) {
			input = input.slice(0, -1 * postfix.length);
		}

		// Remove the thousand grouping.
		if ( thousand ) {
			input = input.split(thousand).join('');
		}

		// Set the decimal separator back to period.
		if ( mark ) {
			input = input.replace(mark, '.');
		}

		// Prepend the negative symbol.
		if ( inputIsNegative ) {
			output += '-';
		}

		// Add the number
		output += input;

		// Trim all non-numeric characters (allow '.' and '-');
		output = output.replace(/[^0-9\.\-.]/g, '');

		// The value contains no parse-able number.
		if ( output === '' ) {
			return false;
		}

		// Covert to number.
		output = Number(output);

		// Run the user-specified post-decoder.
		if ( decoder ) {
			output = decoder(output);
		}

		// Check is the output is valid, otherwise: return false.
		if ( !isValidNumber(output) ) {
			return false;
		}

		return output;
	}
1347886
function _formatCountable(number, singularStr, pluralStr) {
        return StringUtils.format(number > 1 ? pluralStr : singularStr, number);
    }
844472
private static void appendInt(StringBuilder sb, int num, int numDigits) {
    if (num < 0) {
      sb.append('-');
      num = -num;
    }
    int x = num;
    while (x > 0) {
      x /= 10;
      numDigits--;
    }
    for (int i = 0; i < numDigits; i++) {
      sb.append('0');
    }
    if (num != 0) {
      sb.append(num);
    }
  }
783478
def dynamic_number_format(self, rb=1, align=1, **fmt_args):
        """"""
        fct = fmt.DynamicNumberFormatter(**fmt_args)
        return self.apply_number_format(fct, rb=rb, align=align)
30788
function (number, width) {
            number += '';
            width -= number.length;
            if (width > 0) {
                return new Array(width + 1).join('0') + number;
            }
            return number + '';
        }
401611
def wrap(self, value):
        ''' 
        '''
        self.validate_wrap(value)
        ret = []
        for field, value in izip(self.types, value):
            ret.append(field.wrap(value))
        return ret
819206
function interpolation3(prefix, v0, i0, v1, i1, v2, suffix) {
    var different = bindingUpdated2(v0, v1);
    different = bindingUpdated(v2) || different;
    return different ? prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + suffix :
        NO_CHANGE;
}
462478
def strnum(prefix: str, num: int, suffix: str = "") -> str:
    
    return "{}{}{}".format(prefix, num, suffix)
422650
def addprefix(subject, prefix):
  

  if not prefix:
    return subject
  dir_, base = split(subject)
  if callable(prefix):
    base = prefix(base)
  else:
    base = prefix + base
  return join(dir_, base)
791102
function wrap_casts(x) {
	x = '' + x;
	if(/^\(.+\)$/.test(x)) {
		return '(' + x + ')';
	}
	if(/::[a-z]+$/.test(x)) {
		if(/^[a-z]+ \->> /.test(x)) {
			return '((' + x + '))';
		}
		return '(' + x + ')';
	}
	return x;
}
661437
function addSep(numberString) {
    var parts = numberString.split('.');
    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    return parts.join('.');
  }
1199983
public static String surround(final String value, final String prefix, final String suffix) {
        validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
        String _prefix = Optional.ofNullable(prefix).orElse("");
        return append(_prefix, value, Optional.ofNullable(suffix).orElse(_prefix));
    }
1278744
def _maybe_append_formatted_extension(numobj, metadata, num_format, number):
    
    if numobj.extension:
        if num_format == PhoneNumberFormat.RFC3966:
            return number + _RFC3966_EXTN_PREFIX + numobj.extension
        else:
            if metadata.preferred_extn_prefix is not None:
                return number + metadata.preferred_extn_prefix + numobj.extension
            else:
                return number + _DEFAULT_EXTN_PREFIX + numobj.extension
    return number
742743
def add_prefixes(self, nsmap: Dict[str, Namespace]) -> None:
        
        [self._g.bind(e[0], e[1]) for e in nsmap.items()]
628018
def expand_ipv6 (ip, num):
    
    i = ip.find("::")
    prefix = ip[:i]
    suffix = ip[i + 2:]
    count = prefix.count(":") + suffix.count(":")
    if prefix:
        count += 1
        prefix = prefix + ":"
    if suffix:
        count += 1
        suffix = ":" + suffix
    if count >= num:
        raise ValueError("invalid ipv6 number: %s" % ip)
    fill = (num - count - 1) * "0:" + "0"
    return prefix + fill + suffix
246414
public void addAllowedPrefix(String prefix) {
        if (prefix.endsWith(".")) {
            prefix = prefix.substring(0, prefix.length() - 1);
        }
        LOG.debug("Allowed prefix: {}", prefix);
        String packageRegex = START + dotsToRegex(prefix) + SEP;
        LOG.debug("Prefix regex: {}", packageRegex);
        patternList.add(Pattern.compile(packageRegex).matcher(""));
    }