るりまサーチ

最速Rubyリファレンスマニュアル検索!
158件ヒット [1-100件を表示] (0.089秒)
トップページ > クエリ:String[x] > クエリ:h[x] > クエリ:y[x] > クラス:Symbol[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Symbol#length -> Integer (9113.0)

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

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

(self.to_s.length と同じです。)

:foo.length #=> 3

@see String#length, String#size...

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

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

...す。

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

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

@see Symbol#end_with?

@see String#start_with?

//emlist[][ruby]{
:hello.start_with?("hell") #=> true
:hello.start_with?(/H/i) #=> true...
...# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false
//}...

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

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

...h?と同じです。)

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

@see Symbol#start_with?

@see String#end_with?

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

# returns true if one of the +suffixes+ matches.
:hello.end_with?("heaven", "ello") #=> true
:h...
...ello.end_with?("heaven", "paradise") #=> false
//}...

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

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

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

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

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

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

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

@see String#match...

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

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

...her とのマッチを行います。

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

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

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

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

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

絞り込み条件を変える

Symbol#match?(regexp, pos = 0) -> bool (9107.0)

regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。

...tch?(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match? を参照してください。

例:

:Ruby.match?(/R.../) # => true
:Ruby.match?('Ruby') # => true
:Ruby.match?('Ruby',1) # => false
:Ruby.match?...
...('uby',1) # => true
:Ruby.match?(/P.../) # => false
$& # => nil

@see Regexp#match?, String#match?...

Symbol#size -> Integer (6013.0)

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

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

(self.to_s.length と同じです。)

:foo.length #=> 3

@see String#length, String#size...

Symbol#[](nth) -> String | nil (3213.0)

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

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

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

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

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

Symbol#[](nth, len) -> String | nil (3213.0)

nth 番目から長さ len の部分文字列を新しく作って返します。

...nth 番目から長さ len の部分文字列を新しく作って返します。

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

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

:foo[1, 2] # => "oo"...

Symbol#[](regexp, nth = 0) -> String | nil (3213.0)

正規表現 regexp の nth 番目の括弧にマッチする最初の部分文字列を返します。

...正規表現 regexp の nth 番目の括弧にマッチする最初の部分文字列を返します。

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

@param regexp 正規表現を指定します。

@param nth 取得したい正規表現レジスタのインデックスを指定します。

:foo...

絞り込み条件を変える

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

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

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

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

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

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

Symbol#slice(nth, len) -> String | nil (3213.0)

nth 番目から長さ len の部分文字列を新しく作って返します。

...nth 番目から長さ len の部分文字列を新しく作って返します。

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

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

:foo[1, 2] # => "oo"...
<< 1 2 > >>