るりまサーチ

最速Rubyリファレンスマニュアル検索!
698件ヒット [1-100件を表示] (0.116秒)

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

String#size -> Integer (24126.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...

StringIO#size -> Integer (18102.0)

文字列の長さを返します。

文字列の長さを返します。

Symbol#size -> Integer (15120.0)

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

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

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

:foo.length #=> 3

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

String#bytesize -> Integer (15119.0)

文字列のバイト長を整数で返します。

...文字列のバイト長を整数で返します。

//emlist[例][ruby]{
#coding:UTF-8
# 実行結果は文字コードによって異なります。
p "いろは".size #=> 3
p "いろは".bytesize #=> 9
//}

@see String#size...

StringScanner#rest_size -> Integer (9142.0)

文字列の残りの長さを返します。 stringscanner.rest.size と同じです。

...す。
string
scanner.rest.size と同じです。

String
Scanner#restsize は将来のバージョンで削除される予定です。
代わりにStringScanner#rest_size を使ってください。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
p s.rest_size # => 11
p...
...s.rest.size # => 11
//}...

絞り込み条件を変える

StringScanner#restsize -> Integer (9142.0)

文字列の残りの長さを返します。 stringscanner.rest.size と同じです。

...す。
string
scanner.rest.size と同じです。

String
Scanner#restsize は将来のバージョンで削除される予定です。
代わりにStringScanner#rest_size を使ってください。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
p s.rest_size # => 11
p...
...s.rest.size # => 11
//}...

String#[](nth) -> String | nil (9135.0)

nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。

...の末尾から数えます。
つまり、 self.size + nth 番目の文字を返します。

nth が範囲外を指す場合は nil を返します。

@param nth 文字の位置を表す整数
@return 指定した位置の文字を表す String オブジェクト

//emlist[例][ruby]{
p 'bar'[2]...

String#slice(nth) -> String | nil (9135.0)

nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。

...の末尾から数えます。
つまり、 self.size + nth 番目の文字を返します。

nth が範囲外を指す場合は nil を返します。

@param nth 文字の位置を表す整数
@return 指定した位置の文字を表す String オブジェクト

//emlist[例][ruby]{
p 'bar'[2]...

StringScanner#matched_size -> Integer | nil (9132.0)

前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。

...びい
s = StringScanner.new(utf8.encode(encode))
s.scan(/#{"\u{308B}".encode(encode)}/)
s.matched_size
end

p run("UTF-8") #=> 3
p run("EUC-JP") #=> 2
p run("Shift_Jis") #=> 2

//}

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
s.matched_size # => nil
s.s...
...can(/\w+/) # => "test"
s.matched_size # => 4
s.scan(/\w+/) # => nil
s.matched_size # => nil
//}...
<< 1 2 3 ... > >>