るりまサーチ

最速Rubyリファレンスマニュアル検索!
28件ヒット [1-28件を表示] (0.057秒)
トップページ > クラス:String[x] > クエリ:_builtin[x] > クエリ:==[x] > クエリ:split[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

検索結果

String#split(sep = $;, limit = 0) -> [String] (26229.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 (26229.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] (26228.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#unpack(template) -> Array (8085.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...@param template pack テンプレート文字列
@return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます...
...されます。
また、`#' から改行あるいはテンプレート文字列の最後まではコメントとみな
され無視されます。

==
= 整数のテンプレート文字のシステム依存性

各テンプレート文字の説明の中で、
short や long はシステムによら...
...rt
l<: little endian int32_t
l!<: little endian signed long
//}

==
= 各テンプレート文字の説明

説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。

: a

ASCII文字列(...
...m template pack テンプレート文字列
@return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで...