キーワード
- Float (12)
- Integer (12)
-
_ _ dir _ _ (12) - ` (12)
- argv0 (12)
- autoload (12)
- autoload? (12)
- caller (36)
- chomp (12)
- chop (12)
- dump (24)
- format (12)
- gets (12)
- gsub (36)
- load (12)
- readline (12)
- readlines (12)
- restore (12)
- setproctitle (12)
- signame (12)
- sprintf (12)
- sub (24)
-
trace
_ var (36) - trap (48)
-
untrace
_ var (12) - warmup (2)
検索結果
先頭5件
-
Kernel
. # String(arg) -> String (18233.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
. # format(format , *arg) -> String (111.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...sprintf("%c", 'a') #=> "a"
//}
フラグ `-' と幅 の指定だけが意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の... -
Kernel
. # gsub(pattern) {|matched| . . . } -> String (111.0) -
$_.gsub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "test\n"
gsub(/es/, '!!') # => "t!!t\n"
//}
@see String#gsub,$_... -
Kernel
. # gsub(pattern , replace) -> String (111.0) -
$_.gsub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "test\n"
gsub(/es/, '!!') # => "t!!t\n"
//}
@see String#gsub,$_... -
Kernel
. # sprintf(format , *arg) -> String (111.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...sprintf("%c", 'a') #=> "a"
//}
フラグ `-' と幅 の指定だけが意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の... -
Kernel
. # sub(pattern) {|matched| . . . } -> String (111.0) -
$_.sub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "testtest\n"
sub(/es/, '!!') # => "t!!ttest\n"
//}
@see String#sub,$_... -
Kernel
. # sub(pattern , replace) -> String (111.0) -
$_.sub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "testtest\n"
sub(/es/, '!!') # => "t!!ttest\n"
//}
@see String#sub,$_... -
Kernel
. # autoload?(const _ name) -> String | nil (110.0) -
const_name が Kernel.#autoload 設定されているか調べます。
...そのパス名を返します。
autoload 設定されていないか、ロード済みなら nil を返します。
@param const_name 定数をString または Symbol で指定します。
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tmp/f... -
Kernel
. # chomp(rs = $ / ) -> String (110.0) -
$_.chomp とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...//emlist[例: ruby -n で "test" を入力][ruby]{
$_ # => "test\n"
chomp # => "test"
//}
//emlist[例: ruby -n で "test," を入力し、 rs に "," を指定][ruby]{
$_ # => "test\n"
chomp # => "test,"
chomp(",") # => "test"
//}
@see String#chomp,$_,$/...