35件ヒット
[1-35件を表示]
(0.034秒)
ライブラリ
- ビルトイン (35)
キーワード
- byterindex (2)
- length (11)
- size (11)
検索結果
先頭4件
-
String
# bytesize -> Integer (18115.0) -
文字列のバイト長を整数で返します。
...文字列のバイト長を整数で返します。
//emlist[例][ruby]{
#coding:UTF-8
# 実行結果は文字コードによって異なります。
p "いろは".size #=> 3
p "いろは".bytesize #=> 9
//}
@see String#size... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (121.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......ら探索を始める
# ing
# ing # 左にずらしていってここで見つかる
//}
@param pattern 探索する部分文字列または正規表現
@param offset 探索を始めるバイト単位のインデックス
//emlist[例][ruby]{
'foo'.byterindex('f')... -
String
# length -> Integer (30.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 (30.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...