別のキーワード
種類
- インスタンスメソッド (130)
- 変数 (48)
- 文書 (41)
- 特異メソッド (36)
- モジュール関数 (24)
ライブラリ
- English (24)
- ビルトイン (112)
- bigdecimal (24)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - shellwords (48)
- uri (12)
クラス
- Array (21)
- BigDecimal (24)
- File (12)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - String (67)
モジュール
- Kernel (48)
- Shellwords (36)
- URI (12)
キーワード
-
$ -F (12) -
$ ; (12) -
$ FIELD _ SEPARATOR (12) -
$ FS (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 3
. 0 . 0 (5) - pack (21)
- pack テンプレート文字列 (12)
- partition (12)
- rpartition (12)
-
ruby 1
. 6 feature (12) - shellsplit (24)
- shellwords (12)
-
to
_ f (12) - unpack (12)
検索結果
先頭5件
-
BigDecimal
# split -> [Integer , String , Integer , Integer] (21407.0) -
BigDecimal 値を 0.xxxxxxx*10**n と表現したときに、 符号 (NaNのときは 0、それ以外は+1か-1になります)、 仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。
...BigDecimal 値を 0.xxxxxxx*10**n と表現したときに、
符号 (NaNのときは 0、それ以外は+1か-1になります)、
仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。
//emlist[][ruby]{
require "bigdecimal"
a = BigDecimal("3.14159265")
f......, x, y, z = a.split
//}
とすると、f = 1、x = "314159265"、y = 10、z = 1 になります。
従って、以下のようにする事で Float に変換することができます。
//emlist[][ruby]{
s = "0."+x
b = f*(s.to_f)*(y**z)
//}
@see BigDecimal#to_f... -
String
# split(sep = $ ; , limit = 0) -> [String] (21334.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...][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(/......、結果の配列末尾に含まれる空文字列が取り除かれている。
p " a b ".split(' ', 0) # => ["a", "b"]
# limit == 1 の場合は元の文字列がそのまま含まれる。
p " a b ".split(' ', 1) # => [" a b "]
//}
@see String#partition, String#rpartition... -
String
# split(sep = $ ; , limit = 0) {|s| . . . } -> self (21234.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...][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(/......、結果の配列末尾に含まれる空文字列が取り除かれている。
p " a b ".split(' ', 0) # => ["a", "b"]
# limit == 1 の場合は元の文字列がそのまま含まれる。
p " a b ".split(' ', 1) # => [" a b "]
//}
@see String#partition, String#rpartition... -
Shell
# split(pathname) -> [String] (18207.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split... -
Shell
:: CommandProcessor # split(pathname) -> [String] (18207.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split... -
Shell
:: Filter # split(pathname) -> [String] (18207.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split... -
URI
. split(url) -> [String | nil] (18207.0) -
URI を要素に分割した文字列の配列を返します。
...st
* port
* registry
* path
* opaque
* query
* fragment
@param url パースしたい URI を文字列として与えます。
@raise URI::InvalidURIError パースに失敗した場合に発生します。
例:
require 'uri'
p URI.split("http://www.ruby-lang.org/")
#=> ["http",......nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]... -
File
. split(pathname) -> [String] (18201.0) -
pathname を dirname とbasename に分割して、2 要 素の配列を返します。
pathname を dirname とbasename に分割して、2 要
素の配列を返します。
//emlist[][ruby]{
[File.dirname(pathname), File.basename(pathname)]
//}
と同じです。
@param pathname パス名を表す文字列を指定します。 -
Shellwords
. split(line) -> [String] (18201.0) -
Bourne シェルの単語分割規則に従った空白区切りの単語分割を行い、 単語 (文字列) の配列を返します。
...返します。
このメソッドは、Shellwords.#shellsplit の別名です。
@param line 分割の対象となる文字列を指定します。
@return 分割結果の各文字列を要素とする配列を返します。
@raise ArgumentError 引数の中に対でないシングルクォー... -
String
# shellsplit -> [String] (9200.0) -
Bourne シェルの単語分割規則に従った空白区切りの単語分割を行い、 単語 (文字列) の配列を返します。
...分割を行い、
単語 (文字列) の配列を返します。
string.shellsplit は、Shellwords.shellsplit(string) と等価です。
@return 分割結果の各文字列を要素とする配列を返します。
@raise ArgumentError 引数の中に対でないシングルクォートまたは......ダブル
クォートが現れた場合に発生します。
@see Shellwords.#shellsplit... -
Shellwords
. # shellsplit(line) -> [String] (6212.0) -
Bourne シェルの単語分割規則に従った空白区切りの単語分割を行い、 単語 (文字列) の配列を返します。
...am line 分割の対象となる文字列を指定します。
@return 分割結果の各文字列を要素とする配列を返します。
@raise ArgumentError 引数の中に対でないシングルクォートまたはダブル
クォートが現れた場合に発生します。
例:......require 'shellwords'
p Shellwords.shellwords(%q{ foo bar "foo bar"\ baz 'foo bar' })
# => ["foo", "bar", "foo bar baz", "foo bar"]
p Shellwords.shellwords(%q{ A B C "D E F" "G","H I" })
# => ["A", "B", "C", "D E F", "G,H I"]...