Results for: "strip"

No documentation available

Class for reading entries out of a tar file

No documentation available
No documentation available
No documentation available

Like String#strip, except that any modifications are made in self; returns self if any modification are made, nil otherwise.

Related: String#lstrip!, String#strip!.

Returns a copy of self with leading whitespace removed; see Whitespace in Strings:

whitespace = "\x00\t\n\v\f\r "
s = whitespace + 'abc' + whitespace
s        # => "\u0000\t\n\v\f\r abc\u0000\t\n\v\f\r "
s.lstrip # => "abc\u0000\t\n\v\f\r "

Related: String#rstrip, String#strip.

Returns a copy of the receiver with trailing whitespace removed; see Whitespace in Strings:

whitespace = "\x00\t\n\v\f\r "
s = whitespace + 'abc' + whitespace
s        # => "\u0000\t\n\v\f\r abc\u0000\t\n\v\f\r "
s.rstrip # => "\u0000\t\n\v\f\r abc"

Related: String#lstrip, String#strip.

Like String#lstrip, except that any modifications are made in self; returns self if any modification are made, nil otherwise.

Related: String#rstrip!, String#strip!.

Like String#rstrip, except that any modifications are made in self; returns self if any modification are made, nil otherwise.

Related: String#lstrip!, String#strip!.

Returns underlying string:

StringIO.open('foo') do |strio|
  p strio.string
  strio.string = 'bar'
  p strio.string
end

Output:

"foo"
"bar"

Related: StringIO#string= (assigns the underlying string).

Assigns the underlying string as other_string, and sets position to zero; returns other_string:

StringIO.open('foo') do |strio|
  p strio.string
  strio.string = 'bar'
  p strio.string
end

Output:

"foo"
"bar"

Related: StringIO#string (returns the underlying string).

Returns the [stored string]:

scanner = StringScanner.new('foobar')
scanner.string # => "foobar"
scanner.concat('baz')
scanner.string # => "foobarbaz"

Replaces the [stored string] with the given other_string:

scanner = StringScanner.new('foobar')
scanner.scan(/foo/)
put_situation(scanner)
# Situation:
#   pos:       3
#   charpos:   3
#   rest:      "bar"
#   rest_size: 3
match_values_cleared?(scanner) # => false

scanner.string = 'baz'         # => "baz"
put_situation(scanner)
# Situation:
#   pos:       0
#   charpos:   0
#   rest:      "baz"
#   rest_size: 3
match_values_cleared?(scanner) # => true

Returns the target string if it was frozen; otherwise, returns a frozen copy of the target string:

m = /(.)(.)(\d+)(\d)/.match("THX1138.")
# => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
m.string # => "THX1138."

Returns a string converted from object.

Tries to convert object to a string using to_str first and to_s second:

String([0, 1, 2])        # => "[0, 1, 2]"
String(0..5)             # => "0..5"
String({foo: 0, bar: 1}) # => "{:foo=>0, :bar=>1}"

Raises TypeError if object cannot be converted to a string.

No documentation available

Returns a string containing the IP address representation in canonical form.

No documentation available

Format and print out counters as a String. This returns a non-empty content only when --yjit-stats is enabled.

Returns help string of OLE method. If the help string is not found, then the method returns nil.

tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser')
method = WIN32OLE::Method.new(tobj, 'Navigate')
puts method.helpstring # => Navigates to a URL or file.

Returns help string.

tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser')
puts tobj.helpstring # => Web Browser interface

Creates a new string of the given length and yields a zero-copy IO::Buffer instance to the block which uses the string as a source. The block is expected to write to the buffer and the string will be returned.

IO::Buffer.string(4) do |buffer|
  buffer.set_string("Ruby")
end
# => "Ruby"

Returns an array of the entry names in the directory at dirpath; sets the given encoding onto each returned entry name:

Dir.entries('/example') # => ["config.h", "lib", "main.rb", "..", "."]
Dir.entries('/example').first.encoding
# => #<Encoding:UTF-8>
Dir.entries('/example', encoding: 'US-ASCII').first.encoding
# => #<Encoding:US-ASCII>

See String Encoding.

Raises an exception if the directory does not exist.

Returns a hash of values parsed from string according to the given format:

Date._strptime('2001-02-03', '%Y-%m-%d') # => {:year=>2001, :mon=>2, :mday=>3}

For other formats, see Formats for Dates and Times. (Unlike Date.strftime, does not support flags and width.)

See also strptime(3).

Related: Date.strptime (returns a Date object).

Search took: 4ms  ·  Total Results: 1743