@param [String] str The string to format

 @return [String] The string, formatted to be used as an option definition
   of a command in the help
19511
def format_as_option(str, io)
      if Cri::Platform.color?(io)
        yellow(str)
      else
        str
      end
    end
1261050
def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
        
        opts = []

        if option._short_opts:
            opts.append(option._short_opts[0])
        if option._long_opts:
            opts.append(option._long_opts[0])
        if len(opts) > 1:
            opts.insert(1, optsep)

        if option.takes_value():
            metavar = option.metavar or option.dest.lower()
            opts.append(mvarfmt % metavar.lower())

        return ''.join(opts)
843974
def format_value(value, options)
      return value.to_s.upcase if options[:type] == Symbol

      value = value.utc if options[:type] == Time

      return value.strftime(Array(options.fetch(:format)).first) if [Date, Time].include? options[:type]

      value
    end
1033903
public static String format(String str, Object... args) {
        str = str.replaceAll("\\{}", "%s");

        return String.format(str, args);
    }
720818
def to_xml_string(str = '')
      str << ('<' << @name.to_s << ' style="' << @style.to_s << '">')
      @color.to_xml_string(str) if @color.is_a?(Color)
      str << ('</' << @name.to_s << '>')
    end
996285
def blank?(str)
      str.nil? or (str.is_a? String and str.strip.empty?)
    end
322139
def options_hash_to_string(options)
      result = ''
      options.sort_by { |key, _| OPTION_ORDER.find_index(key) || -1 }.each do |key, value|
        if value
          result += "set #{OptionHandling.option_to_string(key, value)}\n"
        else
          result += "unset #{key}\n"
        end
      end
      result
    end
897233
def call(str)
      pos = 0
      buffers = []
      result = [:multi]
      buffers << result
      match = nil

      str.scan(ERB_EXPR) do |indicator, code, newlines|
        match = Regexp.last_match
        len  = match.begin(0) - pos

        text = str[pos, len]
        pos  = match.end(0)
        ch   = indicator ? indicator[0] : nil

        if text and !text.empty? # text
          buffers.last << [:static, text]
        end

        if ch == ?= # <%= %>
          if code =~ BLOCK_EXPR
            buffers.last << [:erb, :block, code, block = [:multi]] # picked up by our own BlockFilter.
            buffers << block
          else
            buffers.last << [:dynamic, code]
          end
        elsif ch =~ /#/ # DISCUSS: doesn't catch <% # this %>
          newlines = code.count("\n")
          buffers.last.concat  [[:newline]] * newlines if newlines > 0
        elsif code =~ /\bend\b/ # <% end %>
          buffers.pop
        elsif ch == ?@
          buffers.last << [:capture, :block, code, block = [:multi]] # picked up by our own BlockFilter. # TODO: merge with %= ?
          buffers << block
        else # <% %>
          if code =~ BLOCK_EXEC
            buffers.last << [:block, code, block = [:multi]] # picked up by Temple's ControlFlow filter.
            buffers << block
          else
            buffers.last << [:code, code]
          end
        end

        # FIXME: only adds one newline.
        # TODO: does that influence speed?
        buffers.last << [:newline] if newlines
      end

      # add text after last/none ERB tag.
      buffers.last << [:static, str[pos..str.length]] if pos < str.length

      buffers.last
    end
855744
def call(str)
      # Set string encoding if option is set
      if options[:encoding] && str.respond_to?(:encoding)
        old = str.encoding
        str = str.dup if str.frozen?
        str.force_encoding(options[:encoding])
        # Fall back to old encoding if new encoding is invalid
        str.force_encoding(old_enc) unless str.valid_encoding?
      end

      result = [:multi]
      reset(str.split($/), [result])

      while @lines.first && @lines.first =~ /\A\s*\Z/
        @stacks.last << [:newline]
        next_line 
      end
      if @lines.first and @lines.first =~ /\A<doctype\s+([^>]*)>?/i
        if !$'.empty? and $'[0] !~ /\s*#/
          fail("did not expect content after doctype")
        end
        @stacks.last << [:html, :doctype, $1]
        next_line
      end

      parse_line while next_line

      reset
      result
    end
108843
function format(str, args) {
        var keys = Object.keys(args), i;
        for (i=0; i<keys.length; i++) {
            str = str.replace(new RegExp("\\{" + keys[i] + "\\}", "gi"), args[keys[i]]);
        }
        return str;
    }
1201028
def _options_string(self):
        
        if len(self.options) > 0:
            s = ""
            for op in self.options:
                if self._sized_op:
                    s += "{:s}={:s} ".format(*map(str, op))
                else:
                    s += "{:s} ".format(str(op))
            return s.strip()
        else:
            return ""
244348
def format(arg)
      if arg.is_a?(Exception)
        "#{arg.class}: #{arg.message}\n\t" <<
        arg.backtrace.join("\n\t") << "\n"
      elsif arg.respond_to?(:to_str)
        arg.to_str
      else
        arg.inspect
      end
    end
1096042
def method_missing(name, *args)
      name = name.to_s
      last_char = name[-1,1]
      super(name, *args) unless last_char == "=" || last_char == "?"
      attr_name = name[0..-2].to_sym # :foo for 'foo=' or 'foo?'
      if last_char == "="
        @options[attr_name] = args.at(0)
      else
        @options[attr_name]
      end
    end
305611
function(str) {
           var reg, value = null;
           if(typeof str === 'string' && str.length) {
               reg = new RegExp('\\s*'+$.trim(this.options.separator)+'\\s*');
               value = str.split(reg);
           } else if($.isArray(str)) {
               value = str; 
           } else {
               value = [str];
           }
           return value;
        }
979762
def format(options)
      options.map do |key, value|
        [{
          format: :f,
          size: :s,
          length: :hls_time,
        }[key] || key, value].map(&:to_s).join('=')
      end
    end
544562
def render_to_string(*)
      result = super
      if result.respond_to?(:each)
        string = +""
        result.each { |r| string << r }
        string
      else
        result
      end
    end
202999
def format_str(self):
        '''  '''
        if self.static:
            return self.route.replace('%','%%')
        out, i = '', 0
        for token, value in self.tokens():
            if token == 'TXT': out += value.replace('%','%%')
            elif token == 'ANON': out += '%%(anon%d)s' % i; i+=1
            elif token == 'VAR': out += '%%(%s)s' % value[1]
        return out