47件ヒット
[1-47件を表示]
(0.057秒)
検索結果
先頭5件
-
String
# split(sep = $ ; , limit = 0) -> [String] (18231.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...列に含まれます。
第 2 引数 limit は以下のいずれかです。
: limit > 0
最大 limit 個の文字列に分割する
: limit == 0
分割個数制限はなしで、配列末尾の空文字列を取り除く
: limit < 0
分割個数の制限はなし
@param sep......][ruby]{
p " a \t b \n c".split(/\s+/) # => ["", "a", "b", "c"]
p " a \t b \n c".split(nil) # => ["a", "b", "c"]
p " a \t b \n c".split(' ') # => ["a", "b", "c"] # split(nil) と同じ
p " a \t b \n c".split # => ["a", "b", "c"] # split(nil) と同じ
//}
//emlist[......'.split(/([-,])/) # => ["1", "-", "10", ",", "20"]
//}
//emlist[正規表現が空文字列にマッチする場合は 1 文字に分割][ruby]{
p 'hi there'.split(/\s*/).join(':') # => "h:i:t:h:e:r:e"
//}
//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p 'hi there'.split(/... -
String
# split(sep = $ ; , limit = 0) {|s| . . . } -> self (18231.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...列に含まれます。
第 2 引数 limit は以下のいずれかです。
: limit > 0
最大 limit 個の文字列に分割する
: limit == 0
分割個数制限はなしで、配列末尾の空文字列を取り除く
: limit < 0
分割個数の制限はなし
@param sep......][ruby]{
p " a \t b \n c".split(/\s+/) # => ["", "a", "b", "c"]
p " a \t b \n c".split(nil) # => ["a", "b", "c"]
p " a \t b \n c".split(' ') # => ["a", "b", "c"] # split(nil) と同じ
p " a \t b \n c".split # => ["a", "b", "c"] # split(nil) と同じ
//}
//emlist[......'.split(/([-,])/) # => ["1", "-", "10", ",", "20"]
//}
//emlist[正規表現が空文字列にマッチする場合は 1 文字に分割][ruby]{
p 'hi there'.split(/\s*/).join(':') # => "h:i:t:h:e:r:e"
//}
//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p 'hi there'.split(/... -
String
# split(sep = $ ; , limit = 0) -> [String] (18230.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。
...列に含まれます。
第 2 引数 limit は以下のいずれかです。
: limit > 0
最大 limit 個の文字列に分割する
: limit == 0
分割個数制限はなしで、配列末尾の空文字列を取り除く
: limit < 0
分割個数の制限はなし
@param sep......][ruby]{
p " a \t b \n c".split(/\s+/) # => ["", "a", "b", "c"]
p " a \t b \n c".split(nil) # => ["a", "b", "c"]
p " a \t b \n c".split(' ') # => ["a", "b", "c"] # split(nil) と同じ
p " a \t b \n c".split # => ["a", "b", "c"] # split(nil) と同じ
//}
//emlist[......'.split(/([-,])/) # => ["1", "-", "10", ",", "20"]
//}
//emlist[正規表現が空文字列にマッチする場合は 1 文字に分割][ruby]{
p 'hi there'.split(/\s*/).join(':') # => "h:i:t:h:e:r:e"
//}
//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p 'hi there'.split(/... -
Array
# pack(template) -> String (87.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...されます。
また、`#' から改行あるいはテンプレート文字列の最後まではコメントとみな
され無視されます。
=== 整数のテンプレート文字のシステム依存性
各テンプレート文字の説明の中で、
short や long はシステムによら......nsigned 16bit(nと同じ)
s>: big endian int16_t
s!>: big endian signed short
l<: little endian int32_t
l!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の......//emlist[][ruby]{
[""].pack("m") # => ""
["\0"].pack("m") # => "AA==\n"
["\0\0"].pack("m") # => "AAA=\n"
["\0\0\0"].pack("m") # => "AAAA\n"
["\xFF"].pack("m") # => "/w==\n"
["\xFF\xFF"].pack("m") # => "//8=\n"
["\xFF\xFF\xFF"].pack("m") # => "////\n"... -
Array
# pack(template , buffer: String . new) -> String (87.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...されます。
また、`#' から改行あるいはテンプレート文字列の最後まではコメントとみな
され無視されます。
=== 整数のテンプレート文字のシステム依存性
各テンプレート文字の説明の中で、
short や long はシステムによら......nsigned 16bit(nと同じ)
s>: big endian int16_t
s!>: big endian signed short
l<: little endian int32_t
l!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の......//emlist[][ruby]{
[""].pack("m") # => ""
["\0"].pack("m") # => "AA==\n"
["\0\0"].pack("m") # => "AAA=\n"
["\0\0\0"].pack("m") # => "AAAA\n"
["\xFF"].pack("m") # => "/w==\n"
["\xFF\xFF"].pack("m") # => "//8=\n"
["\xFF\xFF\xFF"].pack("m") # => "////\n"... -
String
# unpack(template) -> Array (87.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...されます。
また、`#' から改行あるいはテンプレート文字列の最後まではコメントとみな
され無視されます。
=== 整数のテンプレート文字のシステム依存性
各テンプレート文字の説明の中で、
short や long はシステムによら......nsigned 16bit(nと同じ)
s>: big endian int16_t
s!>: big endian signed short
l<: little endian int32_t
l!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の......//emlist[][ruby]{
[""].pack("m") # => ""
["\0"].pack("m") # => "AA==\n"
["\0\0"].pack("m") # => "AAA=\n"
["\0\0\0"].pack("m") # => "AAAA\n"
["\xFF"].pack("m") # => "/w==\n"
["\xFF\xFF"].pack("m") # => "//8=\n"
["\xFF\xFF\xFF"].pack("m") # => "////\n"...