LoginSignup
8
8

More than 5 years have passed since last update.

String クラスのメソッドを類似グループ分け

Last updated at Posted at 2015-03-18

個人的なイメージです。
String クラスのメソッドの全てではありません。念のため。

追加: */+/concat(<<)/prepend/insert
バイト指定追加: setbyte
末尾除去: chomp/chomp!/chop/chop!(!付きメソッドの返値注意)
端部空白除去: strip/strip!/lstrip/lstrip!/rstrip/rstrip!(!付きメソッドの返値注意)
削除: clear/delete/delete!
重複削除: squeeze/squeeze!
切り出し: [](slice)/slice!/byteslice/chr
バイト指定切り出し: getbyte
数量: size(length)/bytesize/empty?
置き換え: replace/tr/tr!/tr_s/tr_s!/sub/sub!/gsub/gsub!/scrub/scrub!(!付きメソッドの返値注意)
フォーマット: format/%/printf/center/ljust/rjust
逆順: reverse/reverse!
大文字小文字: capitalize/capitalize!/upcase/upcase!/downcase/downcase!/swapcase/swapcase!
正規表現での評価: match
区分した配列: split/partition/rpartition
繰り返しマッチした配列: scan
配列へ変換: split/bytes/chars/codepoints/lines
Enumeratorに変換: each_byte/each_char/each_codepoint/each_line
数値へ変換: to_i/to_f/to_c/to_r/oct/hex
シンボルへ変換: to_sym(intern)
文字列: to_s(to_str)/inspect/dump
変換: unpack
暗号化: crypt
チェックサム: sum
比較: ==(===)(eql?)/=~/<=>/casecmp
文字列評価: include?/ascii_only?/start_with?/end_with?
エンコード変更: b/encode/encode!/force_encoding/unicode_normalize/unicode_normalize!
エンコード情報: encoding/unicode_normalized?/valid_encoding?
文字コード: ord
次の文字列: succ(next)/succ!(next!)/upto
要素位置: index/rindex
数え上げ: count

参考:class String

関連:

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8