ライブラリ
- ビルトイン (7934)
クラス
-
ARGF
. class (240) - Array (117)
- BasicObject (12)
- Bignum (6)
- Binding (7)
- Complex (24)
- Data (12)
- Dir (179)
- Encoding (108)
-
Encoding
:: Converter (156) -
Encoding
:: InvalidByteSequenceError (36) -
Encoding
:: UndefinedConversionError (24) - Enumerator (24)
-
Enumerator
:: ArithmeticSequence (7) -
Enumerator
:: Chain (7) - Exception (68)
- FalseClass (24)
- File (168)
-
File
:: Stat (24) - Fixnum (6)
- Float (24)
- Hash (24)
- IO (430)
- Integer (60)
- LoadError (12)
- MatchData (158)
- Method (36)
- Module (648)
- NameError (12)
- NilClass (19)
- Object (337)
- Proc (36)
-
Process
:: Status (24) - Random (29)
- Range (88)
- Rational (24)
- Refinement (4)
- Regexp (168)
- RubyVM (24)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (140) - Set (6)
- SignalException (12)
- String (2184)
- Struct (96)
- Symbol (383)
- SyntaxError (3)
- Thread (88)
-
Thread
:: Backtrace :: Location (72) - Time (66)
- TracePoint (55)
- TrueClass (24)
- UnboundMethod (96)
- UncaughtThrowError (11)
モジュール
-
File
:: Constants (12) - GC (12)
-
GC
:: Profiler (12) - Kernel (732)
- Marshal (48)
- Process (26)
-
RubyVM
:: AbstractSyntaxTree (10) - Signal (36)
キーワード
-
$ " (12) -
$ & (12) -
$ & # 39; (12) -
$ * (12) -
$ + (12) -
$ , (12) -
$ -0 (12) -
$ -F (12) -
$ -I (12) -
$ -i (12) -
$ / (12) -
$ 0 (12) -
$ 1 (12) -
$ 10 (12) -
$ 11 (12) -
$ 2 (12) -
$ 3 (12) -
$ 4 (12) -
$ 5 (12) -
$ 6 (12) -
$ 7 (12) -
$ 8 (12) -
$ 9 (12) -
$ : (12) -
$ ; (12) -
$ @ (12) -
$ FILENAME (12) -
$ LOADED _ FEATURES (12) -
$ LOAD _ PATH (12) -
$ PROGRAM _ NAME (12) -
$ \ (12) -
$ _ (12) -
$ ` (12) - % (26)
- * (36)
- + (12)
- +@ (10)
- -@ (10)
- << (12)
- <=> (24)
- == (24)
- === (48)
- =~ (52)
- Complex (12)
- Converter (12)
- Encoding (12)
- Enumerator (12)
- Float (12)
-
INSTRUCTION
_ NAMES (12) - Integer (12)
- MatchData (12)
- NULL (12)
- NoMethodError (12)
- OPTS (24)
-
RUBY
_ COPYRIGHT (12) -
RUBY
_ DESCRIPTION (12) -
RUBY
_ ENGINE (12) -
RUBY
_ ENGINE _ VERSION (10) -
RUBY
_ PLATFORM (12) -
RUBY
_ RELEASE _ DATE (12) -
RUBY
_ REVISION (6) -
RUBY
_ VERSION (12) - Regexp (12)
- Symbol (12)
- [] (228)
- []= (120)
-
_ _ dir _ _ (12) -
_ _ id _ _ (12) -
_ dump (12) - ` (12)
-
absolute
_ path (36) -
alias
_ method (12) -
append
_ as _ bytes (1) - argv0 (12)
- arity (12)
-
ascii
_ only? (12) -
asciicompat
_ encoding (24) - asctime (12)
- attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (24)
- autoload? (24)
- b (12)
- backtrace (24)
-
base
_ label (24) - basename (12)
- binread (12)
- binwrite (12)
- byteindex (3)
- byterindex (3)
- bytes (43)
- bytesize (12)
- byteslice (36)
- bytesplice (10)
- caller (36)
- capitalize (24)
- capitalize! (12)
- captures (12)
- casecmp (24)
- casecmp? (18)
- center (12)
- chars (24)
- children (23)
- chomp (24)
- chomp! (12)
- chop (24)
- chop! (12)
- chr (36)
- class (12)
-
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) - clear (12)
- clone (36)
- codepoints (24)
- compile (12)
-
compile
_ option (12) - concat (21)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ set (12) -
const
_ source _ location (12) - convert (12)
- count (12)
- cover? (19)
- crypt (12)
- ctime (12)
- deconstruct (2)
- dedup (3)
-
default
_ internal (12) - define (6)
-
define
_ method (48) -
define
_ singleton _ method (24) - delete (36)
- delete! (12)
-
delete
_ prefix (8) -
delete
_ prefix! (8) -
delete
_ suffix (8) -
delete
_ suffix! (8) -
deprecate
_ constant (12) -
destination
_ encoding _ name (24) - dev (12)
- dirname (12)
- disasm (24)
- disassemble (24)
- downcase (24)
- downcase! (12)
- dummy? (12)
- dump (36)
- dup (24)
-
each
_ byte (24) -
each
_ char (24) -
each
_ codepoint (24) -
each
_ grapheme _ cluster (16) -
each
_ line (24) - empty? (24)
- encode (36)
- encode! (24)
- encoding (24)
-
end
_ with? (18) - entries (24)
- eql? (24)
-
error
_ bytes (12) -
error
_ char (12) - escape (12)
-
eval
_ script (7) - extname (12)
- fetch (36)
- filename (12)
- find (12)
- finish (12)
-
for
_ fd (12) -
force
_ encoding (12) - format (12)
- freeze (12)
- ftype (24)
- getbyte (12)
- getc (24)
- gets (84)
- getwd (12)
- glob (24)
-
grapheme
_ clusters (16) - gsub (84)
- gsub! (48)
- hash (24)
- hex (12)
- home (24)
- id2name (12)
-
import
_ methods (4) - include? (12)
- index (19)
-
inplace
_ mode (12) - insert (12)
-
insert
_ output (12) - inspect (399)
-
instance
_ method (12) - intern (24)
- itself (12)
- join (24)
- key (12)
- keys (12)
- label (24)
-
last
_ match (24) - length (24)
- lines (24)
- ljust (12)
- load (12)
-
load
_ from _ binary _ extra _ data (10) -
locale
_ charmap (12) - lstrip (12)
- lstrip! (12)
- match (36)
- match? (18)
- method (12)
-
method
_ defined? (12) -
module
_ function (36) - name (51)
- name= (10)
-
name
_ list (12) -
named
_ captures (12) - names (36)
- new (139)
- next (24)
- next! (12)
- oct (12)
- open (24)
- ord (24)
- pack (21)
- parse (10)
- partition (12)
- path (102)
-
post
_ match (12) -
pre
_ match (12) - pread (8)
- prepend (21)
- private (75)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ method _ defined? (12) - protected (48)
-
protected
_ method _ defined? (12) - public (75)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) - putback (24)
- putc (12)
- pwd (12)
- pwrite (8)
- quote (12)
-
raw
_ seed (2) - read (72)
-
read
_ nonblock (24) -
readagain
_ bytes (12) - readchar (24)
- readline (84)
- readlines (84)
- readlink (12)
- readpartial (24)
- realdirpath (12)
- realpath (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) - replace (12)
- replacement (12)
- replacement= (12)
- restore (12)
- result (12)
- reverse (12)
- reverse! (12)
- rindex (12)
- rjust (12)
- rpartition (12)
- rstrip (12)
- rstrip! (12)
- scan (24)
- scrub (36)
- scrub! (36)
-
set
_ backtrace (12) -
set
_ encoding (72) - setbyte (12)
- setproctitle (12)
- shift (12)
- signame (12)
- signm (12)
-
singleton
_ class (12) -
singleton
_ method (12) - size (24)
- slice (132)
- slice! (72)
- source (12)
-
source
_ location (43) - split (31)
- sprintf (12)
- squeeze (12)
- squeeze! (12)
-
start
_ with? (18) - status (12)
- step (31)
- store (12)
- strftime (12)
- string (12)
- strip (12)
- strip! (12)
- sub (60)
- sub! (36)
- succ (24)
- succ! (12)
- sum (12)
- swapcase (24)
- swapcase! (12)
- sysread (12)
- syswrite (12)
- tainted? (6)
- then (14)
-
thread
_ variable? (12) -
to
_ a (24) -
to
_ binary (10) -
to
_ c (12) -
to
_ f (12) -
to
_ i (12) -
to
_ path (27) -
to
_ r (12) -
to
_ s (367) -
to
_ str (24) -
to
_ sym (24) - tr (12)
- tr! (12)
-
tr
_ s (12) -
tr
_ s! (12) - trace (12)
-
trace
_ var (36) - trap (48)
-
try
_ convert (24) -
undef
_ method (12) - undump (8)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - union (12)
- unpack (12)
- unpack1 (9)
-
untrace
_ var (12) - upcase (24)
- upcase! (12)
- upto (12)
- urandom (8)
- using (12)
-
valid
_ encoding? (12) - values (12)
-
values
_ at (24) - warmup (2)
-
with
_ object (24) - write (24)
-
write
_ nonblock (12) -
yield
_ self (16) - zone (12)
検索結果
先頭5件
-
String
# chomp(rs = $ / ) -> String (29131.0) -
self の末尾から rs で指定する改行コードを取り除いた文字列を生成して返します。 ただし、rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。
...# => "foo"
p "foo\n".chomp # => "foo"
p "foo\n\r".chomp # => "foo\n"
p "string\n".chomp(nil) # => "string\n"
p "foo\r\n\n".chomp("") # => "foo"
p "foo\n\r\n".chomp("") # => "foo"
p "foo\n\r\r".chomp("") # => "foo\n\r\r"
//}
@see String#chomp!
@see String#chop
@see String#delete_suffix... -
String
# delete _ suffix(suffix) -> String (29131.0) -
文字列の末尾から suffix を削除した文字列のコピーを返します。
...。
@return 文字列の末尾から suffix を削除した文字列のコピー
//emlist[][ruby]{
"hello".delete_suffix("llo") # => "he"
"hello".delete_suffix("hel") # => "hello"
//}
@see String#chomp
@see String#chop
@see String#delete_prefix
@see String#delete_suffix!
@see String#end_with?... -
String
# swapcase(*options) -> String (29131.0) -
大文字を小文字に、小文字を大文字に変更した文字列を返します。
...した文字列を返します。
@param options オプションの詳細は String#downcase を参照してください。
//emlist[例][ruby]{
p "ABCxyz".swapcase # => "abcXYZ"
p "Access".swapcase # => "aCCESS"
//}
@see String#swapcase!, String#upcase, String#downcase, String#capitalize... -
String
. try _ convert(obj) -> String | nil (29129.0) -
obj を String に変換しようと試みます。変換には Object#to_str メソッ ドが使われます。変換後の文字列を返すか、何らかの理由により変換できなかっ た場合は nil が返されます。
...obj を String に変換しようと試みます。変換には Object#to_str メソッ
ドが使われます。変換後の文字列を返すか、何らかの理由により変換できなかっ
た場合は nil が返されます。
@param obj 変換する任意のオブジェクト
@return......変換後の文字列または nil
//emlist[例][ruby]{
String.try_convert("str") # => "str"
String.try_convert(/re/) # => nil
//}... -
String
# capitalize -> String (29125.0) -
文字列先頭の文字を大文字に、残りを小文字に変更した文字列を返します。 ただし、アルファベット以外の文字は位置に関わらず変更しません。
...ット以外の文字は位置に関わらず変更しません。
//emlist[例][ruby]{
p "foobar--".capitalize # => "Foobar--"
p "fooBAR--".capitalize # => "Foobar--"
p "FOOBAR--".capitalize # => "Foobar--"
//}
@see String#capitalize!, String#upcase,
String#downcase, String#swapcase... -
String
# chomp(rs = $ / ) -> String (29125.0) -
self の末尾から rs で指定する改行コードを取り除いた文字列を生成して返します。 ただし、rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。
...=> "foo"
p "foo\r\n".chomp # => "foo"
p "foo\n".chomp # => "foo"
p "foo\n\r".chomp # => "foo\n"
p "string\n".chomp(nil) # => "string\n"
p "foo\r\n\n".chomp("") # => "foo"
p "foo\n\r\n".chomp("") # => "foo"
p "foo\n\r\r".chomp("") # => "foo\n\r\r"
//}
@see String#chomp!
@see String#chop... -
String
# chr -> String (29125.0) -
self の最初の文字だけを含む文字列を返します。
...uby]{
a = "abcde"
a.chr #=> "a"
//}
Ruby 1.9 で IO#getc の戻り値が Integer から String を返すように変更になりました。
Ruby 1.8 以前と1.9以降の互換性を保つために String#chr が存在します。
例:
# ruby 1.8 系では STDIN.getc が 116 を返すため......Integer#chr が呼び出される
$ echo test | ruby -e "p STDIN.getc.chr" # => "t"
# ruby 1.9 系以降では STDIN.getc が "t" を返すため String#chr が呼び出される
$ echo test | ruby -e "p STDIN.getc.chr" # => "t"
@see String#ord, Integer#chr... -
String
# inspect -> String (29125.0) -
文字列オブジェクトの内容を、出力したときに人間が読みやすいような適当な形式に変換します。 変換された文字列は印字可能な文字のみによって構成されます
...ために用意されています。
永続化などの目的で文字列をダンプしたいときは、
String#dump を使うべきです。
//emlist[例][ruby]{
# p ではないことに注意
puts "string".inspect # => "string"
puts "\t\r\n".inspect # => "\t\r\n"
//}
@see String#dump... -
String
# swapcase -> String (29125.0) -
'A' から 'Z' までのアルファベット大文字を小文字に、 'a' から 'z' までのアルファベット小文字を大文字に変更した文字列を返します。
...識する」だけであって、
いわゆる全角アルファベットの大文字小文字までは変換しません。
//emlist[例][ruby]{
p "ABCxyz".swapcase # => "abcXYZ"
p "Access".swapcase # => "aCCESS"
//}
@see String#swapcase!, String#upcase, String#downcase, String#capitalize... -
String
# delete _ prefix(prefix) -> String (29119.0) -
文字列の先頭から prefix を削除した文字列のコピーを返します。
...する文字列を指定します。
@return 文字列の先頭から prefix を削除した文字列のコピー
//emlist[][ruby]{
"hello".delete_prefix("hel") # => "lo"
"hello".delete_prefix("llo") # => "hello"
//}
@see String#delete_prefix!
@see String#delete_suffix
@see String#start_with?... -
String
# lines(rs = $ / , chomp: false) -> [String] (29119.0) -
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
...た各行に対して String#chomp と同等の結果を得
る場合は true を、そうでない場合は false で指定します。
省略した場合は false を指定したとみなされます。
ブロックが指定された場合は String#each_line と同じ......ように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_line... -
String
# [](nth) -> String | nil (29118.0) -
nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。
...nth が範囲外を指す場合は nil を返します。
@param nth 文字の位置を表す整数
@return 指定した位置の文字を表す String オブジェクト
//emlist[例][ruby]{
p 'bar'[2] # => "r"
p 'bar'[2] == ?r # => true
p 'bar'[-1] # => "r"
p 'bar'[3] # => nil... -
String
# byteslice(nth , len=1) -> String | nil (29118.0) -
nth バイト目から長さ len バイトの部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は nil を返します。
...。
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1, 2) # => "el"
"\u3042\u3044\u3046".byteslice(0, 3) # => "\u3042"
//}
@see String#slice
@see String#bytesplice... -
String
# byteslice(range) -> String | nil (29118.0) -
range で指定したバイトの範囲に含まれる部分文字列を返します。引数が範囲 外を指定した場合は nil を返します。
...ェクト
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1..2) # => "el"
"\x03\u3042\xff".byteslice(1..3) # => "\u3042"
//}
@see String#slice
@see String#bytesplice...