別のキーワード
クラス
-
ARGF
. class (108) - Array (81)
- BasicObject (12)
- Binding (7)
- Complex (24)
- Data (6)
- Dir (55)
- Encoding (48)
-
Encoding
:: Converter (84) -
Encoding
:: InvalidByteSequenceError (12) -
Encoding
:: UndefinedConversionError (12) - Enumerator (24)
- Exception (68)
- FalseClass (24)
- File (24)
-
File
:: Stat (24) - Float (24)
- Hash (24)
- IO (70)
- Integer (60)
- MatchData (158)
- Method (36)
- Module (540)
- NilClass (19)
- Object (249)
- Proc (36)
- Random (12)
- Range (69)
- Rational (24)
- Refinement (4)
- Regexp (84)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (94) - Set (6)
- SignalException (12)
- String (2106)
- Struct (48)
- Symbol (59)
- Thread (42)
-
Thread
:: Backtrace :: Location (72) - Time (66)
- TracePoint (31)
- TrueClass (24)
- UnboundMethod (96)
- UncaughtThrowError (11)
キーワード
- % (26)
- * (36)
- + (12)
- +@ (10)
- -@ (10)
- << (12)
- <=> (24)
- == (24)
- === (36)
- =~ (40)
- [] (132)
- []= (96)
-
_ _ id _ _ (12) -
_ dump (12) -
absolute
_ path (24) -
alias
_ method (12) - arity (12)
- asctime (12)
- attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (12)
- autoload? (12)
- b (12)
- backtrace (24)
-
base
_ label (24) - byteindex (3)
- byterindex (3)
- bytes (36)
- bytesize (12)
- byteslice (36)
- capitalize (12)
- capitalize! (12)
- captures (12)
- casecmp (24)
- casecmp? (18)
- center (12)
- chars (24)
- children (7)
- chomp (12)
- chomp! (12)
- chop (12)
- chop! (12)
- chr (36)
- class (12)
-
class
_ variable _ get (12) -
class
_ variable _ set (12) - clear (12)
- clone (24)
- codepoints (24)
- concat (21)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ set (12) -
const
_ source _ location (12) - convert (12)
- count (12)
- crypt (12)
- ctime (12)
- deconstruct (2)
- dedup (3)
-
define
_ method (24) -
define
_ singleton _ method (24) - delete (12)
- delete! (12)
-
delete
_ prefix (8) -
delete
_ prefix! (8) -
delete
_ suffix (8) -
delete
_ suffix! (8) -
deprecate
_ constant (12) - dev (12)
- disasm (12)
- disassemble (12)
- downcase (12)
- downcase! (12)
- dump (12)
- dup (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? (18) - eql? (24)
-
error
_ bytes (12) -
error
_ char (12) -
eval
_ script (7) - filename (12)
- finish (12)
-
force
_ encoding (12) - freeze (12)
- ftype (12)
- getbyte (12)
- getc (12)
- gets (36)
-
grapheme
_ clusters (16) - gsub (48)
- gsub! (48)
- hash (24)
- hex (12)
-
import
_ methods (4) - include? (12)
- index (12)
-
inplace
_ mode (12) - insert (12)
-
insert
_ output (12) - inspect (319)
-
instance
_ method (12) - intern (12)
- itself (12)
- join (12)
- label (24)
- length (12)
- lines (24)
- ljust (12)
- lstrip (12)
- lstrip! (12)
- match (24)
- match? (18)
- method (12)
-
method
_ defined? (12) -
module
_ function (36) - name (41)
- name= (10)
-
named
_ captures (12) - names (36)
- next (12)
- next! (12)
- oct (12)
- ord (24)
- pack (21)
- partition (12)
- path (75)
-
post
_ match (12) -
pre
_ match (12) - pread (8)
- prepend (21)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) - public (12)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) - putback (24)
- pwrite (8)
- read (24)
- readchar (12)
- readlines (36)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) - replace (12)
- replacement (12)
- replacement= (12)
- reverse (12)
- reverse! (12)
- rindex (12)
- rjust (12)
- rpartition (12)
- rstrip (12)
- rstrip! (12)
- scan (24)
- scrub (36)
- scrub! (36)
-
set
_ backtrace (12) - setbyte (12)
- signm (12)
-
singleton
_ class (12) -
singleton
_ method (12) - size (12)
- slice (72)
- slice! (72)
- source (12)
-
source
_ location (43) - split (19)
- squeeze (12)
- squeeze! (12)
-
start
_ with? (18) - step (31)
- strftime (12)
- string (12)
- strip (12)
- strip! (12)
- sub (36)
- sub! (36)
- succ (12)
- succ! (12)
- sum (12)
- swapcase (12)
- swapcase! (12)
- syswrite (12)
- tainted? (6)
- then (14)
-
to
_ a (12) -
to
_ binary (10) -
to
_ c (12) -
to
_ f (12) -
to
_ i (12) -
to
_ path (27) -
to
_ r (12) -
to
_ s (301) -
to
_ str (24) -
to
_ sym (12) - tr (12)
-
tr
_ s (12) -
tr
_ s! (12) -
undef
_ method (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) -
values
_ at (12) -
with
_ object (24) -
yield
_ self (16) - zone (12)
検索結果
先頭5件
-
String
# partition(sep) -> [String , String , String] (30530.0) -
セパレータ sep が最初に登場する部分で self を 3 つに分割し、 [最初のセパレータより前の部分, セパレータ, それ以降の部分] の 3 要素の配列を返します。
...@param sep セパレータを表す文字列か正規表現を指定します。
//emlist[例][ruby]{
p "axaxa".partition("x") # => ["a", "x", "axa"]
p "aaaaa".partition("x") # => ["aaaaa", "", ""]
p "aaaaa".partition("") # => ["", "", "aaaaa"]
//}
@see String#rpartition, String#split... -
String
# rpartition(sep) -> [String , String , String] (30530.0) -
セパレータ sep が最後に登場する部分で self を 3 つに分割し、 [最後のセパレータより前の部分, セパレータ, それ以降の部分] の 3 要素の配列を返します。
...と第 2 要素が空文字列になります。
@param sep セパレータを表す文字列か正規表現を指定します。
//emlist[例][ruby]{
p "axaxa".rpartition("x") # => ["axa", "x", "a"]
p "aaaaa".rpartition("x") # => ["", "", "aaaaa"]
//}
@see String#partition, String#split... -
String
# tr(pattern , replace) -> String (30364.0) -
pattern 文字列に含まれる文字を検索し、 それを replace 文字列の対応する文字に置き換えます。
...pattern 文字列に含まれる文字を検索し、
それを replace 文字列の対応する文字に置き換えます。
pattern の形式は tr(1) と同じです。つまり、
`a-c' は a から c を意味し、"^0-9" のように
文字列の先頭が `^' の場合は指定文字以外......囲が pattern の範囲よりも小さい場合は、
replace の最後の文字が無限に続くものとして扱われます。
@param pattern 置き換える文字のパターン
@param replace pattern で指定した文字を置き換える文字
//emlist[例][ruby]{
p "foo".tr("f", "......oo"
p "foo".tr('a-z', 'A-Z') # => "FOO"
p "FOO".tr('A-Z', 'a-z') # => "foo"
# シーザー暗号の復号
p "ORYV".tr("A-Z", "D-ZA-C") # => "RUBY"
# 全角英数字といくつかの記号の半角化
email = "ruby−lang@example.com"
p email.tr("0-9... -
String
# lstrip -> String (30350.0) -
文字列の先頭にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。
...にある空白文字を全て取り除いた新しい文字列を返します。
空白文字の定義は " \t\r\n\f\v\0" です。
//emlist[例][ruby]{
p " abc\n".lstrip #=> "abc\n"
p "\t abc\n".lstrip #=> "abc\n"
p "abc\n".lstrip #=> "abc\n"
//}
@see String#strip, String#rstrip... -
String
# rstrip -> String (30350.0) -
文字列の末尾にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。
...白文字の定義は " \t\r\n\f\v\0" です。
//emlist[例][ruby]{
p " abc\n".rstrip #=> " abc"
p " abc \t\r\n\0".rstrip #=> " abc"
p " abc".rstrip #=> " abc"
p " abc\0 ".rstrip #=> " abc"
str = "abc\n"
p str.rstrip #=> "abc"
p str #=> "abc\n"......(元の文字列は変化しない)
//}
@see String#lstrip,String#strip... -
String
# strip -> String (30344.0) -
文字列先頭と末尾の空白文字を全て取り除いた文字列を生成して返します。 空白文字の定義は " \t\r\n\f\v\0" です。
...義は " \t\r\n\f\v\0" です。
//emlist[例][ruby]{
p " abc \r\n".strip #=> "abc"
p "abc\n".strip #=> "abc"
p " abc".strip #=> "abc"
p "abc".strip #=> "abc"
p " \0 abc \0".strip #=> "abc"
str = "\tabc\n"
p str.strip #=> "abc"
p str......#=> "\tabc\n" (元の文字列は変化しない)
//}
@see String#lstrip, String#rstrip... -
String
# tr _ s(pattern , replace) -> String (30334.0) -
文字列の中に pattern 文字列に含まれる文字が存在したら、 replace 文字列の対応する文字に置き換えます。さらに、 置換した部分内に同一の文字の並びがあったらそれを 1 文字に圧縮します。
...文字列の中に pattern 文字列に含まれる文字が存在したら、
replace 文字列の対応する文字に置き換えます。さらに、
置換した部分内に同一の文字の並びがあったらそれを 1 文字に圧縮します。
pattern の形式は tr(1) と同じです......が pattern の範囲よりも小さい場合、
replace の最後の文字が無限に続くものとして扱われます。
@param pattern 置き換える文字のパターン
@param replace pattern で指定した文字を置き換える文字
//emlist[例][ruby]{
p "gooooogle".tr_s("o",......) # => "gXgle"
p "gooooogle".tr_s("a-z", "A-Z") # => "GOGLE"
//}
注意:
一般に、tr_s を tr と squeeze で置き換えることはできません。
tr と squeeze の組みあわせでは tr の置換後の文字列全体を squeeze しますが、
tr_s は置換された部分だけ... -
String
# rstrip! -> self | nil (30149.0) -
文字列の末尾にある空白文字を全て破壊的に取り除きます。 空白文字の定義は " \t\r\n\f\v\0" です。
...的に取り除きます。
空白文字の定義は " \t\r\n\f\v\0" です。
//emlist[例][ruby]{
str = " abc\n"
p str.rstrip! # => " abc"
p str # => " abc"
str = " abc \r\n\t\v\0"
p str.rstrip! # => " abc"
p str # => " abc"
//}
@see String#rstrip, String#lstrip... -
String
# strip! -> self | nil (30143.0) -
先頭と末尾の空白文字を全て破壊的に取り除きます。 空白文字の定義は " \t\r\n\f\v\0" です。
..." \t\r\n\f\v\0" です。
strip! は、内容を変更した self を返します。
ただし取り除く空白がなかったときは nil を返します。
//emlist[例][ruby]{
str = " abc\r\n"
p str.strip! #=> "abc"
p str #=> "abc"
str = "abc"
p str.strip! #=> nil
p str......#=> "abc"
str = " \0 abc \0"
str.strip!
p str #=> "abc"
//}
@see String#strip, String#lstrip...