るりまサーチ

最速Rubyリファレンスマニュアル検索!
383件ヒット [101-200件を表示] (0.065秒)

別のキーワード

  1. string []=
  2. string []
  3. string slice
  4. string slice!
  5. string gsub

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 > >>

Symbol#slice(nth) -> String | nil (126.0)

nth 番目の文字を返します。

...nth 番目の文字を返します。

(self.to_s[nth] と同じです。)

@
param nth 文字の位置を表す整数を指定します。

:foo[0] # => "f"
:foo[1] # => "o"
:foo[2] # => "o"...

Symbol#id2name -> String (122.0)

シンボルに対応する文字列を返します。

...シンボルに対応する文字列を返します。

逆に、文字列に対応するシンボルを得るには
String
#intern を使います。

p :foo.id2name # => "foo"
p :foo.id2name.intern == :foo # => true

@
see String#intern...

Symbol#to_s -> String (122.0)

シンボルに対応する文字列を返します。

...シンボルに対応する文字列を返します。

逆に、文字列に対応するシンボルを得るには
String
#intern を使います。

p :foo.id2name # => "foo"
p :foo.id2name.intern == :foo # => true

@
see String#intern...

Symbol#[](substr) -> String | nil (121.0)

self が substr を含む場合、一致した文字列を新しく作って返します。

self が substr を含む場合、一致した文字列を新しく作って返します。

(self.to_s[substr] と同じです。)

例:
:foobar.slice("foo") # => "foo"
:foobar.slice("baz") # => nil

Symbol#slice(substr) -> String | nil (121.0)

self が substr を含む場合、一致した文字列を新しく作って返します。

self が substr を含む場合、一致した文字列を新しく作って返します。

(self.to_s[substr] と同じです。)

例:
:foobar.slice("foo") # => "foo"
:foobar.slice("baz") # => nil

絞り込み条件を変える

Symbol#to_json(*args) -> String (115.0)

自身を JSON 形式の文字列に変換して返します。

...部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@
param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

@
see JSON::Generator::GeneratorMethods::Hash#to_json...

Symbol#name -> String (109.0)

シンボルに対応する文字列を返します。

...シンボルに対応する文字列を返します。

Symbol
#to_sと違って freeze された文字列を返します。

//emlist[][ruby]{
p :fred.name # => "fred"
p :fred.name.frozen? # => true
p :fred.to_s # => "fred"
p :fred.to_s.frozen? # => false
//}

@
see Symbol#to_s...

Symbol#match(other) -> MatchData | nil (32.0)

正規表現 other とのマッチを行います。

...正規表現 other とのマッチを行います。

(self.to_s.match(other) と同じです。)

@
param other 比較対象のシンボルを指定します。

@
return マッチが成功すれば MatchData オブジェクトを、そうでなければ nil を返します。

p :foo.match(/foo/)...
...# => #<MatchData "foo">
p :foobar.match(/bar/) # => #<MatchData "bar">
p :foo.match(/bar/) # => nil

@
see String#match
@
see Symbol#match?...

Symbol#=~(other) -> Integer | nil (26.0)

正規表現 other とのマッチを行います。

...。)

@
param other 比較対象のシンボルを指定します。

@
return マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。

p :foo =~ /foo/ # => 0
p :foobar =~ /bar/ # => 3
p :foo =~ /bar/ # => nil

@
see String#=~...

Symbol#end_with?(*suffixes) -> bool (26.0)

self の末尾が suffixes のいずれかであるとき true を返します。

...ixes のいずれかであるとき true を返します。

(self.to_s.end_with?と同じです。)

@
param suffixes パターンを表す文字列 (のリスト)

@
see Symbol#start_with?

@
see String#end_with?

//emlist[][ruby]{
:hello.end_with?("ello") #=> true

# returns true if on...

絞り込み条件を変える

Symbol#match(other) -> Integer | nil (26.0)

正規表現 other とのマッチを行います。

...す。)

@
param other 比較対象のシンボルを指定します。

@
return マッチが成功すればマッチした位置を、そうでなければ nil を返します。

p :foo.match(/foo/) # => 0
p :foobar.match(/bar/) # => 3
p :foo.match(/bar/) # => nil

@
see String#match...

Symbol#start_with?(*prefixes) -> bool (26.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...れかであるとき true を返します。

(self.to_s.start_with?と同じです。)

@
param prefixes パターンを表す文字列または正規表現 (のリスト)

@
see Symbol#end_with?

@
see String#start_with?

//emlist[][ruby]{
:hello.start_with?("hell") #=> true
:hello.sta...

Symbol#<=>(other) -> -1 | 0 | 1 | nil (20.0)

self と other のシンボルに対応する文字列を ASCII コード順で比較して、 self が小さい時には -1、等しい時には 0、大きい時には 1 を返します。

...er がシンボルではなく比較できない時には nil を返します。

@
param other 比較対象のシンボルを指定します。

//emlist[][ruby]{
p :aaa <=> :xxx # => -1
p :aaa <=> :aaa # => 0
p :xxx <=> :aaa # => 1
p :foo <=> "foo" # => nil
//}

@
see String#<=>, Symbol#casecmp...
<< < 1 2 3 4 > >>