Format a subPath, return its plain form if it is
a literal string or number. Otherwise prepend the
dynamic indicator (*).
339640
function formatSubPath (path) {
  const trimmed = path.trim();
  // invalid leading 0
  if (path.charAt(0) === '0' && isNaN(path)) { return false }

  return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed
}
1046025
def make_path(*sub_paths):
        
        queued_params = [quote(c.encode('utf-8'), '') for c in sub_paths if c not in NULL_VALUES]
        queued_params.insert(0, '')
        return '/'.join(queued_params)
846388
def get_formatted_path(path):
        
        if path[0] != '/':
            path = '/' + path
        if path[-1] != '/':
            path = '{0}/'.format(path)
        return path
1316058
def mark_path(path):
    
    # If given path is not string,
    # or given path is absolute path.
    if not isinstance(path, str) or os.path.isabs(path):
        # Get error message
        msg = 'Error (2D9ZA): Given path is not relative path: {0}.'.format(
            path
        )

        # Raise error
        raise ValueError(msg)

    # If given path is string,
    # and given path is not absolute path.

    # Wrap given path
    return _ItemWrapper(type='path', item=path)
264084
function (path) {
        if (path[path.length - 1] === '/') {
            path = path.substr(0, path.length - 1);
        }
        return path;
    }
1156226
function(fsPath, strict) {
		if (!_.isString(fsPath)) {
			throw new TypeError('path must be of type string');
		}
		return fsPath === module.exports.reformatPath(fsPath, strict);
	}
1108190
private static String prependSlash(final String path) {
        if (path.length() == 0 || path.charAt(0) != '/') {
            /* our path doesn't start with a slash, so we prepend it */
            return "/" + path;
        }
        return path;
    }
58557
function format(value) {
    if (typeof value == 'number')
      return value;

    var str = String(value);
    var ary = str.split('\n').map((e) => JSON.stringify(e));
    if (ary.length > 1) {
      // If the string has newlines, start it off on its own line so that
      // it's easier to compare against another string with newlines.
      return '\n' + ary.join('\n');
    } else {
      return ary.join('\n');
    }
  }
241531
def odinweb_node_formatter(path_node):
        # type: (PathParam) -> str
        
        args = [path_node.name]
        if path_node.type:
            args.append(path_node.type.name)
        if path_node.type_args:
            args.append(path_node.type_args)
        return "{{{}}}".format(':'.join(args))
804516
def insert_slash(string, every=2):
    """"""
    return os.path.join(string[i:i+every] for i in xrange(0, len(string), every))
605981
private String getSubPath(String[] pathElements, int begin) {

        String result = "";
        for (int i = begin; i < pathElements.length; i++) {
            result += pathElements[i] + "/";
        }
        if (result.length() > 0) {
            result = result.substring(0, result.length() - 1);
        }
        return result;
    }
480112
def identical_format_path(fmt1, fmt2):
    """"""
    for key in ['extension', 'prefix', 'suffix']:
        if fmt1.get(key) != fmt2.get(key):
            return False
    return True
539445
def rel_path(base, path):
    """"""
    if base == path:
        return ''
    assert is_prefix(base, path), "{} not a prefix of {}".format(base, path)
    return path[len(base):].strip('.')
776297
def NormalizeRelativePath(path):
        """"""
        path_components = path.split('/')
        normalized_components = []
        for component in path_components:
            if re.match(r'{[A-Za-z0-9_]+}$', component):
                normalized_components.append(
                    '{%s}' % Names.CleanName(component[1:-1]))
            else:
                normalized_components.append(component)
        return '/'.join(normalized_components)
914147
function format(str, ctx) {
	var splitter = '{',
		isInside = false,
		segment,
		valueAndFormat,
		path,
		i,
		len,
		ret = [],
		val,
		index;
	
	while ((index = str.indexOf(splitter)) !== -1) {
		
		segment = str.slice(0, index);
		if (isInside) { // we're on the closing bracket looking back
			
			valueAndFormat = segment.split(':');
			path = valueAndFormat.shift().split('.'); // get first and leave format
			len = path.length;
			val = ctx;

			// Assign deeper paths
			for (i = 0; i < len; i++) {
				val = val[path[i]];
			}

			// Format the replacement
			if (valueAndFormat.length) {
				val = formatSingle(valueAndFormat.join(':'), val);
			}

			// Push the result and advance the cursor
			ret.push(val);
			
		} else {
			ret.push(segment);
			
		}
		str = str.slice(index + 1); // the rest
		isInside = !isInside; // toggle
		splitter = isInside ? '}' : '{'; // now look for next matching bracket
	}
	ret.push(str);
	return ret.join('');
}
243703
def _formatNumbers(self, line):
        
        # below thousands separator syntax only works for
        # python 2.7, skip for 2.6
        if sys.version_info < (2, 7):
            return line

        last_index = 0
        try:
            # find the index of the last } character
            last_index = (line.rindex('}') + 1)
            end = line[last_index:]
        except ValueError:
            return line
        else:
            # split the string on numbers to isolate them
            splitted = re.split("(\d+)", end)
            for index, val in enumerate(splitted):
                converted = 0
                try:
                    converted = int(val)
                # if it's not an int pass and don't change the string
                except ValueError:
                    pass
                else:
                    if converted > 1000:
                        splitted[index] = format(converted, ",d")
            return line[:last_index] + ("").join(splitted)
378761
function getFormatStringFrom (formattedString) {
      var chunks = formattedString.match(R_FORMAT_CHUNKS);

      if (!chunks) {
        // chunks will be null if there were no tokens to parse in
        // formattedString (for example, if formattedString is '2').  Coerce
        // chunks to be useful here.
        chunks = ['', ''];

        // If there is only one chunk, assume that the string is a number
        // followed by a token...
        // NOTE: This may be an unwise assumption.
      } else if (chunks.length === 1 ||
          // ...or if the string starts with a number component (".", "-", or a
          // digit)...
          formattedString[0].match(R_NUMBER_COMPONENT)) {
        // ...prepend an empty string here to make sure that the formatted number
        // is properly replaced by VALUE_PLACEHOLDER
        chunks.unshift('');
      }

      return chunks.join(VALUE_PLACEHOLDER);
    }