るりまサーチ

最速Rubyリファレンスマニュアル検索!
35件ヒット [1-35件を表示] (0.050秒)
トップページ > クラス:String[x] > ライブラリ:ビルトイン[x] > クエリ:bytesize[x] > クエリ:string[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. string bytesize
  2. _builtin bytesize
  3. bytesize _builtin

キーワード

検索結果

String#bytesize -> Integer (27117.0)

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

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

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

@see String#size...

String#byterindex(pattern, offset = self.bytesize) -> Integer | nil (9135.0)

文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...は正規表現で指定します。

offset が負の場合は、文字列の末尾から数えた位置から探索します。

byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索...
...//emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}

//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterinde...
...erindex('o', 0) # => nil
'foo'.byterindex('o', 1) # => 1
'foo'.byterindex('o', 2) # => 2
'foo'.byterindex('o', 3) # => 2

'foo'.byterindex('o', -1) # => 2
'foo'.byterindex('o', -2) # => 1
'foo'.byterindex('o', -3) # => nil
'foo'.byterindex('o', -4) # => nil
//}

@see String#rindex, String#byteindex...

String#length -> Integer (9032.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 (9032.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...