キーワード
- % (12)
- * (12)
- + (12)
- +@ (10)
- -@ (10)
- << (12)
- <=> (12)
- == (12)
- === (12)
- =~ (12)
- [] (72)
- []= (84)
- b (12)
- byteindex (3)
- byterindex (3)
- bytes (24)
- bytesize (12)
- byteslice (36)
- capitalize (12)
- capitalize! (12)
- casecmp (12)
- casecmp? (9)
- center (12)
- chars (24)
- chomp (12)
- chomp! (12)
- chop (12)
- chop! (12)
- chr (12)
- clear (12)
- codepoints (24)
- concat (21)
- count (12)
- crypt (12)
- dedup (3)
- delete (12)
- delete! (12)
-
delete
_ prefix (8) -
delete
_ prefix! (8) -
delete
_ suffix (8) -
delete
_ suffix! (8) - downcase (12)
- downcase! (12)
- dump (12)
-
each
_ byte (24) -
each
_ char (24) -
each
_ codepoint (24) -
each
_ grapheme _ cluster (16) -
each
_ line (24) - empty? (12)
- encode (36)
- encode! (24)
- encoding (12)
-
end
_ with? (12) - eql? (12)
-
force
_ encoding (12) - getbyte (12)
-
grapheme
_ clusters (16) - gsub (48)
- gsub! (48)
- hash (12)
- hex (12)
- include? (12)
- index (12)
- insert (12)
- inspect (12)
- intern (12)
- iseuc (12)
- length (12)
- lines (24)
- ljust (12)
- lstrip (12)
- lstrip! (12)
- match (24)
- match? (9)
- next (12)
- next! (12)
- oct (12)
- ord (12)
-
parse
_ csv (12) - partition (12)
- prepend (21)
- replace (12)
- reverse (12)
- reverse! (12)
- rindex (12)
- rjust (12)
- rpartition (12)
- rstrip (12)
- rstrip! (12)
- scan (24)
- scrub (36)
- scrub! (36)
- setbyte (12)
- size (12)
- slice (72)
- slice! (72)
- split (19)
- squeeze (12)
- squeeze! (12)
-
start
_ with? (12) - strip (12)
- strip! (12)
- sub (36)
- sub! (36)
- succ (12)
- succ! (12)
- sum (12)
- swapcase (12)
- swapcase! (12)
-
to
_ c (12) -
to
_ f (12) -
to
_ i (12) -
to
_ r (12) -
to
_ s (12) -
to
_ str (12) -
to
_ sym (12) - tr (12)
-
tr
_ s (12) -
tr
_ s! (12) - undump (8)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - unpack (12)
- unpack1 (9)
- upcase (12)
- upcase! (12)
- upto (12)
-
valid
_ encoding? (12)
検索結果
先頭5件
-
String
# scrub! {|bytes| . . . } -> String (30226.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えます。常に self を返します。
...ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub! # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub!("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub... -
String
# scrub!(repl) -> String (30226.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えます。常に self を返します。
...ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub! # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub!("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub... -
String
# scrub(repl) -> String (30226.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えた新しい文字列を返します。
...ブ
ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub!... -
String
# next! -> String (30224.0) -
self を「次の」文字列に置き換えます。 「次の」文字列は、アルファベットなら 16 進数、 数字なら 10 進数とみなして計算されます。 「次の」文字列の計算では "99" → "100" のように繰り上げも行われます。 このとき負符号などは考慮されません。
...、
単に文字列をバイト列として扱います。
なお、succ! と逆の動作をするメソッドはありません。
//emlist[例][ruby]{
p "aa".succ # => "ab"
# 繰り上がり
p "99".succ # => "100"
p "a9".succ # => "b0"
p "Az".succ # => "Ba"
p "zz".succ # => "aaa"
p "-......# => "-10"
p "9".succ # => "10"
p "09".succ # => "10"
# アルファベット・数字とそれ以外の混在
p "1.9.9".succ # => # "2.0.0"
# アルファベット・数字以外のみ
p ".".succ # => "/"
p "\0".succ # => "\001"
p "\377".succ # => "\001\000"
//}
@see String#succ... -
String
# succ! -> String (30224.0) -
self を「次の」文字列に置き換えます。 「次の」文字列は、アルファベットなら 16 進数、 数字なら 10 進数とみなして計算されます。 「次の」文字列の計算では "99" → "100" のように繰り上げも行われます。 このとき負符号などは考慮されません。
...、
単に文字列をバイト列として扱います。
なお、succ! と逆の動作をするメソッドはありません。
//emlist[例][ruby]{
p "aa".succ # => "ab"
# 繰り上がり
p "99".succ # => "100"
p "a9".succ # => "b0"
p "Az".succ # => "Ba"
p "zz".succ # => "aaa"
p "-......# => "-10"
p "9".succ # => "10"
p "09".succ # => "10"
# アルファベット・数字とそれ以外の混在
p "1.9.9".succ # => # "2.0.0"
# アルファベット・数字以外のみ
p ".".succ # => "/"
p "\0".succ # => "\001"
p "\377".succ # => "\001\000"
//}
@see String#succ... -
String
# sub!(pattern , hash) -> String (30223.0) -
文字列中の pattern にマッチした部分をキーにして hash を引いた値で破壊的に置き換えます。
文字列中の pattern にマッチした部分をキーにして hash を引いた値で破壊的に置き換えます。
@param pattern 置き換える文字列のパターン
@param hash 置き換える文字列を与えるハッシュ
@return 置換した場合は self、置換しなかった場合は nil -
String
# sub(pattern , hash) -> String (30223.0) -
文字列中の pattern にマッチした部分をキーにして hash を引いた値で置き換えます。
...で置き換えます。
@param pattern 置き換える文字列のパターン
@param hash 置き換える文字列を与えるハッシュ
//emlist[例][ruby]{
hash = {'b'=>'B', 'c'=>'C'}
p "abcabc".sub(/[bc]/){hash[$&]} #=> "aBCabc"
p "abcabc".sub(/[bc]/, hash) #=> "aBCabc"
//}... -
String
# +(other) -> String (30222.0) -
文字列と other を連結した新しい文字列を返します。
...er を連結した新しい文字列を返します。
@param other 文字列
@return self と other を連結した文字列
//emlist[例][ruby]{
p "str" + "ing" # => "string"
a = "abc"
b = "def"
p a + b # => "abcdef"
p a # => "abc" (変化なし)
p b # => "def"
//}... -
String
# delete(*strs) -> String (30222.0) -
self から strs に含まれる文字を取り除いた文字列を生成して返します。
...合は、
すべての引数にマッチする文字だけが削除されます。
@param strs 削除する文字列を示す文字列 (のリスト)
//emlist[例][ruby]{
p "123456789".delete("2378") #=> "14569"
p "123456789".delete("2-8", "^4-6") #=> "14569"
//}
@see String#delete!... -
String
# dump -> String (30222.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\x00\b10\\\""
//}
@see String#undump...