るりまサーチ

最速Rubyリファレンスマニュアル検索!
2077件ヒット [701-800件を表示] (0.163秒)

別のキーワード

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

ライブラリ

キーワード

検索結果

<< < ... 6 7 8 9 10 ... > >>

String#insert(pos, other) -> self (36132.0)

pos 番目の文字の直前に文字列 other を挿入します。 self[pos, 0] = other と同じ操作です。

...の直前に文字列 other を挿入します。
self[pos, 0] = other と同じ操作です。

@
param pos 文字列を挿入するインデックス
@
param other 挿入する文字列

//emlist[例][ruby]{
str = "foobaz"
str.insert(3, "bar")
p str # => "foobarbaz"
//}

@
see String#[]=...

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

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

...は Integer#chr の結果に相当する文字を末尾に追加します。追加する文字のエンコーディングは self.encoding です。

self を返します。

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

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

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

str = "foo"
str.concat("!", 33, 33)
p str # => "foo!!!"
//}

@
see String#append_as_bytes...

String#concat(other) -> self (36124.0)

self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。

...other を破壊的に連結します。
other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。

self を返します。

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

//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "str...
...ingXXX"

str << "YYY"
p str # => "stringXXXYYY"

str << 65 # 文字AのASCIIコード
p str # => "stringXXXYYYA"
//}...

String#each_byte -> Enumerator (36120.0)

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

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

//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114

"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}

@
see String#bytes...

String#each_codepoint -> Enumerator (36120.0)

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

...ントに対して繰り返します。

UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE) 以外のエンコーディングに対しては
各文字のバイナリ表現由来の値になります。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 124...
...31, 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 (36120.0)

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

...ントに対して繰り返します。

UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE) 以外のエンコーディングに対しては
各文字のバイナリ表現由来の値になります。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 124...
...31, 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 (36120.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#setbyte(index, b) -> Integer (36120.0)

index バイト目のバイトを b に変更します。

...を返します。

@
param index バイトをセットする位置
@
param b セットするバイト(0 から 255 までの整数)
@
raise IndexError 範囲外に値をセットしようとした場合に発生します。

//emlist[例][ruby]{
s = "Sunday"
s.setbyte(0, 77)
s.setbyte(-5, 111)
s # =>...

String#to_c -> Complex (36120.0)

自身を複素数 (Complex) に変換した結果を返します。

...形式を解析できます。i、j は大文字、小文字のどちらでも解析できます。

* 実部+虚部i
* 実部+虚部j
* 絶対値@偏角

それぞれの数値は以下のいずれかの形式で指定します。先頭の空白文字や複素
数値の後にある文字列は無...
...list[例][ruby]{
'9'.to_c # => (9+0i)
'2.5'.to_c # => (2.5+0i)
'2.5/1'.to_c # => ((5/2)+0i)
'-3/2'.to_c # => ((-3/2)+0i)
'-i'.to_c # => (0-1i)
'45i'.to_c # => (0+45i)
'3-4i'.to_c # => (3-4i)
'-4e2-4e-2i'.to_c # => (-400.0-0.04i)
'-0.0-0.0i'.to_...
...c # => (-0.0-0.0i)
'1/2+3/4i'.to_c # => ((1/2)+(3/4)*i)
'10@10'.to_c # => (-8.390715290764524-5.440211108893697i)
'-0.3_3'.to_c # => (-0.33+0i)
" \t\r\n5+3i".to_c # => (5+3i)
'5+3ix'.to_c # => (5+3i)
'ruby'.to_c # => (0+0i)
//}...

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

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

...は Integer#chr の結果に相当する文字を末尾に追加します。追加する文字のエンコーディングは self.encoding です。

self を返します。

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

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

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

str = "foo"
str.concat("!", 33, 33)
p str # => "foo!!!"
//}...

絞り込み条件を変える

<< < ... 6 7 8 9 10 ... > >>