ライブラリ
- ビルトイン (914)
-
cgi
/ html (24) - csv (24)
- json (24)
-
json
/ add / range (12) - kconv (12)
- openssl (48)
- optparse (144)
- rake (24)
-
rexml
/ document (24) -
rubygems
/ remote _ fetcher (24) - stringio (108)
- strscan (108)
-
webrick
/ httpauth / userdb (12) - zlib (12)
クラス
-
ARGF
. class (37) - BasicObject (12)
-
CSV
:: Table (24) - Class (12)
- Encoding (12)
- FalseClass (24)
-
Gem
:: RemoteFetcher (24) - IO (105)
- Module (192)
- Object (54)
-
OpenSSL
:: X509 :: ExtensionFactory (24) -
OpenSSL
:: X509 :: StoreContext (24) - OptionParser (144)
-
REXML
:: Text (24) -
Rake
:: FileList (24) - Range (31)
- Regexp (12)
- String (364)
- StringIO (108)
- StringScanner (108)
- Symbol (47)
- Thread (24)
- UnboundMethod (24)
-
Zlib
:: Inflate (12)
モジュール
キーワード
- +@ (10)
- -@ (10)
- == (24)
- === (36)
- [] (72)
-
_ _ id _ _ (12) -
ascii
_ only? (12) - attr (36)
-
beginning
_ of _ line? (12) - bol? (12)
- casecmp? (18)
-
class
_ variable _ defined? (12) - clone (12)
- closed? (12)
-
closed
_ read? (12) -
closed
_ write? (12) -
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) - cover? (19)
-
create
_ extension (24) - dedup (3)
-
deprecate
_ constant (12) - dummy? (12)
- dup (12)
-
each
_ line (18) - empty? (36)
-
end
_ with? (18) - eof (12)
- eof? (12)
- eos? (12)
- eql? (24)
- error= (12)
-
fetch
_ path (12) - freeze (12)
-
get
_ passwd (12) - gets (54)
- html (24)
- include? (12)
- inspect (12)
-
is
_ a? (12) - isatty (12)
- iseuc (12)
-
json
_ creatable? (12) -
kind
_ of? (12) - lines (18)
- match? (18)
- matched? (12)
-
method
_ defined? (12) - name (5)
- on (144)
-
open
_ uri _ or _ path (12) -
private
_ class _ method (24) -
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
public
_ method _ defined? (12) -
read
_ nonblock (34) - readline (27)
- readlines (27)
- rest? (12)
-
scan
_ full (12) -
search
_ full (12) -
singleton
_ class (12) - slice (72)
-
start
_ with? (18) - status (12)
- sync (12)
- sync= (12)
- tainted? (6)
-
thread
_ variable? (12) -
to
_ csv (12) -
to
_ json (24) -
to
_ s (36) - tty? (12)
-
undef
_ method (12) -
unicode
_ normalized? (11) - upto (12)
-
valid
_ encoding? (12) - value (12)
- verify (12)
-
write
_ nonblock (12)
検索結果
先頭5件
-
StringScanner
# string -> String (21281.0) -
スキャン対象にしている文字列を返します。
...quire 'strscan'
s = StringScanner.new('test string')
s.string # => "test string"
//}
返り値は freeze されていません。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.string.frozen? # => false
//}
なお、このメソッドは StringScanner.new に渡......を書かないようにしましょう。
//emlist[例][ruby]{
require 'strscan'
str = 'test string'
s = StringScanner.new(str)
s.string == str # => true
s.string.eql?(str) # => true (将来は false になる可能性がある)
//}
また、返り値の文字列に対して破壊的な変更......ないでください。
//emlist[例][ruby]{
require 'strscan'
str = 'test string'
s = StringScanner.new(str)
s.string.replace("0123")
s.scan(/\w+/) # => "0123" (将来は "test" が返る可能性あり)
str # => "0123" (将来は "test string" が返る可能性あり)
//}... -
String
# lines(rs = $ / , chomp: false) -> [String] (9234.0) -
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
...た各行に対して String#chomp と同等の結果を得
る場合は true を、そうでない場合は false で指定します。
省略した場合は false を指定したとみなされます。
ブロックが指定された場合は String#each_line と同じ......ように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_line... -
String
# eql?(other) -> bool (9155.0) -
文字列の内容が文字列 other の内容と等しいときに true を返します。 等しくなければ false を返します。
...しくなければ false を返します。
このメソッドは文字列の内容を比較します。
同一のオブジェクトかどうかを比較するわけではありません。
つまり、"string".eql?(str) という式を実行した場合には、
str が "string" という内容の......、String#upcase,
String#downcase で大文字小文字を揃えてから比較してください。
Hash クラス内での比較に使われます。
@param other 任意のオブジェクト
@return true か false
//emlist[例][ruby]{
p "string".eql?("string") # => true
p "string".e......ql?("STRING") # => false
p "string".eql?("") # => false
p "".eql?("string") # => false
p "string".eql?("str" + "ing") # => true (内容が同じなら true)
p "string".eql?("stringX".chop) # => true (内容が同じなら true)
p "string".upcase.eql?("String".upcase) # =>... -
String
# +@ -> String | self (9138.0) -
self が freeze されている文字列の場合、元の文字列の複製を返します。 freeze されていない場合は self を返します。
...eeze されていない場合は self を返します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text)......# => true
original_text = "text".freeze
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text) # => false
//}
@see String#-@... -
String
# lines(rs = $ / , chomp: false) {|line| . . . } -> self (9134.0) -
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
...た各行に対して String#chomp と同等の結果を得
る場合は true を、そうでない場合は false で指定します。
省略した場合は false を指定したとみなされます。
ブロックが指定された場合は String#each_line と同じ......ように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_line... -
String
# -@ -> String | self (9127.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
...します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false
original_text = "text".freeze
frozen_text......= -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}
@see String#+@... -
String
# dedup -> String | self (9127.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
...します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false
original_text = "text".freeze
frozen_text......= -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}
@see String#+@... -
String
# -@ -> String | self (9126.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
...します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false
original_text = "text".freeze
frozen_text......= -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}
@see String#+@... -
String
# eql?(other) -> bool (9125.0) -
文字列の内容が文字列 other の内容と等しいときに true を返します。 等しくなければ false を返します。
...しくなければ false を返します。
このメソッドは文字列の内容を比較します。
同一のオブジェクトかどうかを比較するわけではありません。
つまり、"string".eql?(str) という式を実行した場合には、
str が "string" という内容の......場合は
String#casecmp? を使ってください。
Hash クラス内での比較に使われます。
@param other 任意のオブジェクト
@return true か false
//emlist[例][ruby]{
p "string".eql?("string") # => true
p "string".eql?("STRING") # => false
p "string".eql?("")......# => false
p "".eql?("string") # => false
p "string".eql?("str" + "ing") # => true (内容が同じなら true)
p "string".eql?("stringX".chop) # => true (内容が同じなら true)
//}
@see Hash, String#<=>, String#casecmp, String#==... -
String
# upto(max , exclusive = false) {|s| . . . } -> self (9124.0) -
self から始めて max まで 「次の文字列」を順番にブロックに与えて繰り返します。 「次」の定義については String#succ を参照してください。
...self から始めて max まで
「次の文字列」を順番にブロックに与えて繰り返します。
「次」の定義については String#succ を参照してください。
たとえば以下のコードは a, b, c, ... z, aa, ... az, ..., za を
出力します。
//emlist[][ruby]......{
("a" .. "za").each do |str|
puts str
end
'a'.upto('za') do |str|
puts str
end
//}
@param max 繰り返しをやめる文字列
@param exclusive max を含むかどうか。false の場合は max を含む。... -
String
# [](nth) -> String | nil (9120.0) -
nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。
...nth が範囲外を指す場合は nil を返します。
@param nth 文字の位置を表す整数
@return 指定した位置の文字を表す String オブジェクト
//emlist[例][ruby]{
p 'bar'[2] # => "r"
p 'bar'[2] == ?r # => true
p 'bar'[-1] # => "r"
p 'bar'[3] # => nil... -
String
# [](substr) -> String | nil (9120.0) -
self が substr を含む場合、一致した文字列を新しく作って返します。 substr を含まなければ nil を返します。
...た文字列を新しく作って返します。
substr を含まなければ nil を返します。
@param substr 取得したい文字列のパターン。文字列
//emlist[例][ruby]{
substr = "bar"
result = "foobar"[substr]
p result # => "bar"
p substr.equal?(result) # => false
//}...