るりまサーチ

最速Rubyリファレンスマニュアル検索!
150件ヒット [1-100件を表示] (0.124秒)

別のキーワード

  1. string []=
  2. string []
  3. string slice
  4. string slice!
  5. string gsub

検索結果

<< 1 2 > >>

String#dump -> String (39231.0)

文字列中の非表示文字をバックスラッシュ記法に置き換えた文字列を返します。 str == eval(str.dump) となることが保証されています。

...に置き換えた文字列を返します。
str == eval(str.dump) となることが保証されています。

//emlist[例][ruby]{
# p だとさらにバックスラッシュが増えて見にくいので puts している
puts "abc\r\n\f\x00\b10\\\"".dump # => "abc\r\n\f\000\01010\\\""
//}...
...字列を返します。
str == eval(str.dump) となることが保証されています。

//emlist[例][ruby]{
# p だとさらにバックスラッシュが増えて見にくいので puts している
puts "abc\r\n\f\x00\b10\\\"".dump # => "abc\r\n\f\000\01010\\\""
//}

@see String#undump...

String#undump -> String (27226.0)

self のエスケープを戻したものを返します。

...self のエスケープを戻したものを返します。

String
#dump の逆変換にあたります。

//emlist[例][ruby]{
"\"hello \\n ''\"".undump #=> "hello \n ''"
//}

@see String#dump...

String#inspect -> String (21138.0)

文字列オブジェクトの内容を、出力したときに人間が読みやすいような適当な形式に変換します。 変換された文字列は印字可能な文字のみによって構成されます

...ために用意されています。
永続化などの目的で文字列をダンプしたいときは、
String
#dump を使うべきです。

//emlist[例][ruby]{
# p ではないことに注意
puts "string".inspect # => "string"
puts "\t\r\n".inspect # => "\t\r\n"
//}

@see String#dump...

Object#_dump(limit) -> String (6331.0)

Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。

...Marshal.#dump において出力するオブジェクトがメソッド _dump
を定義している場合には、そのメソッドの結果が書き出されます。

バージョン1.8.0以降ではObject#marshal_dump, Object#marshal_loadの使用
が推奨されます。 Marshal.dump するオ...
...ブジェクトが _dump と marshal_dump の両方の
メソッドを持つ場合は marshal_dump が優先されます。

メソッド _dump は引数として再帰を制限するレベル limit を受
け取り、オブジェクトを文字列化したものを返します。

インスタン...
...rg)
@foo = arg
end
def _dump(limit)
Marshal.dump(@foo, limit)
end
def self._load(obj)
p obj
Foo.new(Marshal.load(obj))
end
end
foo = Foo.new(['foo', 'bar'])
p foo #=> #<Foo:0xbaf234 @foo=["foo", "bar"]>
dms = Marshal.dump(foo)
p dms...

BigDecimal#_dump -> String (6231.0)

BigDecimal._load で復元可能な文字列を返します。 Marshal.#dump から呼び出されます。

...Marshal.#dump から呼び出されます。

//emlist[][ruby]{
require 'bigdecimal'
inf = BigDecimal('Infinity') # => Infinity
s = Marshal.dump(inf) # => "\x04\bu:\x0FBigDecimal\x0F9:Infinity"
Marshal.load(s) # => Infinity
//}

@see BigDecimal._load, Marshal.#dump, Marshal.#loa...

絞り込み条件を変える

Gem::Specification#_dump -> String (6225.0)

重要なインスタンス変数のみを Marshal.#dump します。

...重要なインスタンス変数のみを Marshal.#dump します。

@see Marshal.#dump...

Encoding::Converter#convert(source_string) -> String (263.0)

与えられた文字列を変換して、変換できた結果を返します。 引数の末尾の文字がバイト列の途中で終わっている場合、そのバイト列は変換器内に取り置かれます。 変換を終了させるには Encoding::Converter#finish を呼びます。

...ープしたい場合やさらに細かい指定を行いたい場合は、Encoding::Converter#primitive_convert を用います。

@param source_string 変換する文字列の一部または全部です。
@return 変換結果である文字列の一部または全部です。
@raise Encoding::In...
...euc-jp")
puts ec.convert("\u3042").dump #=> "\xA4\xA2"
puts ec.finish.dump #=> ""

ec = Encoding::Converter.new("euc-jp", "utf-8")
puts ec.convert("\xA4").dump #=> ""
puts ec.convert("\xA2").dump #=> "\xE3\x81\x82"
puts ec.finish.dump #=> ""

ec = Encodi...
..., "iso-2022-jp")
puts ec.convert("\xE3").dump #=> "".force_encoding("ISO-2022-JP")
puts ec.convert("\x81").dump #=> "".force_encoding("ISO-2022-JP")
puts ec.convert("\x82").dump #=> "\e$B$\"".force_encoding("ISO-2022-JP")
puts ec.finish.dump #=> "\e(B".force_encoding...

Encoding::Converter#insert_output(string) -> nil (156.0)

変換器内のバッファに文字列を挿入します。 バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。

...れるべきです。

@param string 挿入する文字列

//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
src = "HIRAGANA LETTER A is \u{3042}."
dst = ""
p ec.primitive_convert(src, dst) #=> :undefined_conversion
puts "[#{dst.dump}, #{src.dump}]" #=> ["HIRAGANA LETTER A...
...dump}, #{src.dump}]" #=> ["HIRAGANA LETTER A is <err>.", ""]

ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
src = "\u{306F 3041 3068 2661 3002}" # U+2661 is not representable in iso-2022-jp
dst = ""
p ec.primitive_convert(src, dst) #=> :undefined_conversion
puts "[#{dst.dump}, #{src.dump...
...B$O$!$H".force_encoding("ISO-2022-JP"), "\xE3\ x80\x82"]
ec.insert_output "?" # state change required to output "?".
p ec.primitive_convert(src, dst) #=> :finished
puts "[#{dst.dump}, #{src.dump}]" #=> ["\e$B$O$!$H\e(B?\e$B!#\e(B".force_encoding("ISO-20 22-JP"), ""]
//}...

Object#psych_to_yaml(options = {}) -> String (115.0)

オブジェクトを YAML document に変換します。

...オブジェクトを YAML document に変換します。

options でオプションを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。

syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。...
...将来的に
syck が廃止された場合 psych_to_yaml は廃止
される予定であるため、特別の事情がない限り to_yaml を用いてください。

@param options 出力オプション
@see Psych.dump...

Object#to_yaml(options = {}) -> String (115.0)

オブジェクトを YAML document に変換します。

...オブジェクトを YAML document に変換します。

options でオプションを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。

syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。...
...将来的に
syck が廃止された場合 psych_to_yaml は廃止
される予定であるため、特別の事情がない限り to_yaml を用いてください。

@param options 出力オプション
@see Psych.dump...

絞り込み条件を変える

<< 1 2 > >>