るりまサーチ

最速Rubyリファレンスマニュアル検索!
1874件ヒット [1701-1800件を表示] (0.069秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < ... 16 17 18 19 > >>

String#each_char {|cstr| block } -> self (9026.0)

文字列の各文字に対して繰り返します。

...文字列の各文字に対して繰り返します。

たとえば、
//emlist[][ruby]{
"hello世界".each_char {|c| print c, ' ' }
//}
は次のように出力されます。
h e l l o 世 界

@
see String#chars...

String#each_codepoint -> Enumerator (9026.0)

文字列の各コードポイントに対して繰り返します。

...ます。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@
see String#codepoints...

String#each_codepoint {|codepoint| block } -> self (9026.0)

文字列の各コードポイントに対して繰り返します。

...ます。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@
see String#codepoints...

String#length -> Integer (9026.0)

文字列の文字数を返します。バイト数を知りたいときは bytesize メソッドを使ってください。

...いときは bytesize メソッドを使ってください。

//emlist[例][ruby]{
"test".length # => 4
"test".size # => 4
"テスト".length # => 3
"テスト".size # => 3
"\x80\u3042".length # => 2
"\x80\u3042".size # => 2
//}

@
see String#bytesize...

String#size -> Integer (9026.0)

文字列の文字数を返します。バイト数を知りたいときは bytesize メソッドを使ってください。

...いときは bytesize メソッドを使ってください。

//emlist[例][ruby]{
"test".length # => 4
"test".size # => 4
"テスト".length # => 3
"テスト".size # => 3
"\x80\u3042".length # => 2
"\x80\u3042".size # => 2
//}

@
see String#bytesize...

絞り込み条件を変える

String#unpack1(format) -> object (9026.0)

formatにしたがって文字列をデコードし、展開された1つ目の値を返します。 unpackは配列を返しますがunpack1は配列の1つ目の要素のみを返します。

...って文字列をデコードし、展開された1つ目の値を返します。
unpackは配列を返しますがunpack1は配列の1つ目の要素のみを返します。

//emlist[例][ruby]{
"ABC".unpack1("C*") # => 65
"ABC".unpack("C*") # => [65, 66, 67]
//}

@
see String#unpack, Array#pack...

String#scan(pattern) {|s| ... } -> self (9025.0)

pattern がマッチした部分文字列をブロックに渡して実行します。 pattern が正規表現で括弧を含む場合は、 括弧で括られたパターンにマッチした文字列の配列を渡します。

...含む場合は、
括弧で括られたパターンにマッチした文字列の配列を渡します。

@
param pattern 探索する部分文字列または正規表現

//emlist[例][ruby]{
"foobarbazfoobarbaz".scan(/ba./) {|s| p s }
# "bar"
# "baz"
# "bar"
# "baz"

"foobarbazfoobarbaz".scan("ba...

String#concat(*arguments) -> self (9024.0)

self に複数の文字列を破壊的に連結します。

...ます。追加する文字のエンコーディングは self.encoding です。

self を返します。

@
param arguments 複数の文字列もしくは 0 以上の整数

//emlist[例][ruby]{
str = "foo"
str.concat
p str # => "foo"

str = "foo"
str.concat "bar", "baz"
p str # => "foobarbaz...

String#count(*chars) -> Integer (9020.0)

chars で指定された文字が文字列 self にいくつあるか数えます。

...引数を複数指定した場合は、
すべての引数にマッチした文字だけを数えます。

@
param chars 出現回数を数える文字のパターン

//emlist[例][ruby]{
p 'abcdefg'.count('c') # => 1
p '123456789'.count('2378') # => 4
p '123456789'.coun...
<< < ... 16 17 18 19 > >>