るりまサーチ

最速Rubyリファレンスマニュアル検索!
766件ヒット [1-100件を表示] (0.079秒)
トップページ > モジュール:Kernel[x] > クエリ:p[x] > クエリ:String[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. matrix p
  5. dsa p

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#String(arg) -> String (18237.0)

引数を文字列(String)に変換した結果を返します。

...引数を文字列(String)に変換した結果を返します。

arg.to_s を呼び出して文字列に変換します。
arg が文字列の場合、何もせず arg を返します。

@param arg 変換対象のオブジェクトです。
@raise TypeError to_s の返り値が文字列でなけ...
...れば発生します。

//emlist[例][ruby]{
class Foo
def to_s
"hogehoge"
end
end

arg = Foo.new
p
String(arg) #=> "hogehoge"
//}

@see Object#to_s,String...

Kernel#libpathflag(libpath = $DEFLIBPATH|$LIBPATH) -> String (6502.0)

与えられた libpath を -L 付きの文字列に変換して返します。

...与えられた libpath を -L 付きの文字列に変換して返します。

@param libpath LIBPATH に指定する値を指定します。...

Kernel.#open(name, mode = &#39;r&#39;, perm = nil, options = {}) -> StringIO | Tempfile | IO (6313.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...http:// や ftp:// で始まっている文字列なら URI のリソースを
取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。
返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

name に open...
...me.open(*rest, &block) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp://...
...ソースを取得した上で StringIO オブジェクト
または Tempfile オブジェクトを引数としてブロックを評価します。後は同様です。
引数のオブジェクトは OpenURI::Meta モジュールで extend されています。


@param name オープンしたいリ...
... StringIO オブジェクト
または Tempfile オブジェクトを引数としてブロックを評価します。後は同様です。
引数のオブジェクトは OpenURI::Meta モジュールで extend されています。

Ruby2.7以降、open-uriにより拡張されたKernel.openでUR...

Kernel.#chomp(rs = $/) -> String (6224.0)

$_.chomp とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。

...$_.chomp とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。
コマンドラインオプションで -p または -n を指定した時のみ定義されます。

暗号的になりすぎるきらいがあるため、このメソッド...
...
今後はより明示的な $_.chomp を使ってください。

$_.chomp とこのメソッド chomp は以下の点で違いがあります。

* chomp は $_ の値をコピーして、コピーの方を更新し、
$_ に再代入します。

@param rs 末尾から削除する改行コ...
...//emlist[例: ruby -n で "test" を入力][ruby]{
$_ # => "test\n"
chomp # => "test"
//}

//emlist[例: ruby -n で "test," を入力し、 rs に "," を指定][ruby]{
$_ # => "test\n"
chomp # => "test,"
chomp(",") # => "test"
//}

@see String#chomp,$_,$/...

Kernel.#chop -> String (6224.0)

$_.chop とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。

...$_.chop とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。
コマンドラインオプションで -p または -n を指定した時のみ定義されます。

暗号的になりすぎるきらいがあるため、このメソッド...
...$_.chop を使ってください。

$_.chopとこのメソッド chop は以下の点で違いがあります。

* chop は $_ の値をコピーして、コピーの方を更新し、
$_ に再代入します。

//emlist[例][ruby]{
$_ = "test\r\n"
$_ # => "test\r\n"
chop #...
...=> "test"
$_ = "test\n"
$_ # => "test\n"
chop # => "test"
$_ = "test"
$_ # => "test"
chop # => "tes"
//}

@see String#chop,$_...

絞り込み条件を変える

Kernel$$FIELD_SEPARATOR -> String | nil (6215.0)

$; の別名

...$; の別名

require "English"

str = "hoge,fuga,ugo,bar,foo"
p
str.split #=> ["hoge,fuga,ugo,bar,foo"]
$FIELD_SEPARATOR = ","
p
str.split #=> ["hoge", "fuga", "ugo", "bar", "foo"]...

Kernel$$INPUT_RECORD_SEPARATOR -> String | nil (6209.0)

$/ の別名

...$/ の別名

require "English"

$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p
array #=> ["ugo|", "ego|", "fogo\n"]

__END__
ugo|ego|fogo...

Kernel$$ERROR_POSITION -> [String] | nil (6208.0)

$@ の別名

...$@ の別名

require "English"
class SomethingError < StandardError; end

begin
raise SomethingError
rescue
p
$ERROR_POSITION #=> ["sample.rb:5"]
end...

Kernel$$LAST_PAREN_MATCH -> String | nil (6208.0)

$+ の別名

...r1 = Regexp.compile("<img src=(http:.+?)>")
r2 = Regexp.compile("<a href=(http|ftp).+?>(.+?)</a>")

while line = DATA.gets
[ r1, r2 ].each {|rep|
rep =~ line
p
$+
}
end
__END__
<tr> <td><img src=http://localhost/a.jpg></td> <td>ikkou</td> <td><a href=http://localhost...
.../link.html>link</a></td> </tr>
#enf of sample.rb

$ ruby sample.rb
"http://localhost/a.jpg"
"link"...

Kernel$$POSTMATCH -> String | nil (6208.0)

$' の別名

...$' の別名

require "English"

str = 'hoge,foo,bar,hee,hoo'

/foo/ =~ str
p
$POSTMATCH #=> ",bar,hee,hoo"...

絞り込み条件を変える

<< 1 2 3 ... > >>