ライブラリ
- ビルトイン (648)
- bigdecimal (36)
- fiddle (24)
- json (12)
-
net
/ ftp (10) -
net
/ http (12) -
net
/ imap (24) - openssl (84)
- optparse (144)
- pathname (24)
-
ripper
/ lexer (24) - scanf (12)
- socket (72)
- stringio (132)
- strscan (132)
-
webrick
/ httpresponse (24) -
win32
/ registry (24) - win32ole (36)
クラス
- Addrinfo (12)
- Array (21)
- BasicObject (12)
- BasicSocket (24)
- BigDecimal (36)
- Binding (7)
-
Fiddle
:: Pointer (24) - IO (32)
- Integer (60)
- Method (12)
- Module (12)
-
Net
:: FTP :: MLSxEntry (10) -
Net
:: HTTP (12) -
Net
:: IMAP (12) -
Net
:: IMAP :: StatusData (12) - Object (60)
-
OpenSSL
:: OCSP :: Response (12) -
OpenSSL
:: PKey :: DH (12) -
OpenSSL
:: SSL :: SSLContext (12) -
OpenSSL
:: SSL :: SSLSocket (24) -
OpenSSL
:: X509 :: Name (12) - OptionParser (144)
- Pathname (24)
- Proc (12)
- Regexp (24)
-
Ripper
:: Lexer (24) - String (321)
- StringIO (132)
- StringScanner (132)
- Struct (24)
- Symbol (39)
- UDPSocket (36)
- UnboundMethod (24)
-
WEBrick
:: HTTPResponse (24) -
WIN32OLE
_ VARIABLE (12) -
WIN32OLE
_ VARIANT (24) -
Win32
:: Registry (24)
モジュール
キーワード
- % (12)
- << (9)
- =~ (36)
- [] (48)
- []= (24)
-
_ _ id _ _ (12) - arity (12)
- attr (12)
- binwrite (12)
- byteindex (3)
- byterindex (3)
- bytes (24)
- bytesize (12)
- charpos (12)
- chr (36)
- cipher (12)
- ciphers (12)
- class (12)
- codepoints (24)
-
compute
_ key (12) - concat (18)
-
const
_ source _ location (12) -
content
_ length (12) -
content
_ length= (12) - count (12)
- exist? (12)
- facts (10)
- getbyte (24)
- hash (24)
- hex (12)
- index (12)
- inspect (12)
-
ip
_ unpack (12) - length (36)
- lex (12)
- lineno (12)
-
local
_ port (12) - match (3)
- match? (12)
-
matched
_ size (12) - matchedsize (12)
- method (12)
-
named
_ captures (12) - oct (12)
-
ole
_ type _ detail (12) - on (144)
- ord (24)
- pack (21)
- parse (12)
- pointer (12)
- pos (24)
-
public
_ method (12) - pwrite (8)
- read (12)
- readbyte (12)
- recvmsg (12)
-
recvmsg
_ nonblock (12) -
rest
_ size (12) - restsize (12)
- rindex (12)
- scanf (12)
- send (36)
- setbyte (12)
-
singleton
_ class (12) - size (36)
- skip (12)
-
skip
_ until (12) -
source
_ location (43) - split (12)
- status (24)
- sum (12)
- syswrite (36)
- tell (12)
-
to
_ a (12) -
to
_ f (12) -
to
_ i (12) -
to
_ json (12) -
to
_ s (36) - truncate (12)
- ungetc (12)
- unpack (12)
- vartype (12)
- write (24)
-
write
_ nonblock (24)
検索結果
先頭5件
-
String
# chr -> String (30269.0) -
self の最初の文字だけを含む文字列を返します。
...by 1.9 で IO#getc の戻り値が Integer から String を返すように変更になりました。
Ruby 1.8 以前と1.9以降の互換性を保つために String#chr が存在します。
例:
# ruby 1.8 系では STDIN.getc が 116 を返すため Integer#chr が呼び出される
$ ech......o 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
# %(args) -> String (30221.0) -
printf と同じ規則に従って args をフォーマットします。
...sprintf("%c", 'a') #=> "a"
//}
フラグ `-' と幅 の指定だけが意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の....../e+/) #=> "/e+/"
//}
: d
: i
引数の数値を10進表現の整数として出力します。
引数が整数でなければ関数 Kernel.#Integer と同じ規則で整数に
変換されます。
//emlist[][ruby]{
p sprintf("%d", -1) #=> "-1"
p sprintf("%d", 3.1) #=> "3"
p sprintf("%d", '... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (30162.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...は正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......//emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterinde......erindex('o', 0) # => nil
'foo'.byterindex('o', 1) # => 1
'foo'.byterindex('o', 2) # => 2
'foo'.byterindex('o', 3) # => 2
'foo'.byterindex('o', -1) # => 2
'foo'.byterindex('o', -2) # => 1
'foo'.byterindex('o', -3) # => nil
'foo'.byterindex('o', -4) # => nil
//}
@see String#rindex, String#byteindex... -
String
# hex -> Integer (30162.0) -
文字列に 16 進数で数値が表現されていると解釈して整数に変換します。 接頭辞 "0x", "0X" とアンダースコアは無視されます。 文字列が [_0-9a-fA-F] 以外の文字を含むときはその文字以降を無視します。
...# => 0
p "10z".hex # => 16
p "1_0".hex # => 16
p "".hex # => 0
//}
@see String#oct, String#to_i, String#to_f,
Kernel.#Integer, Kernel.#Float
このメソッドの逆に数値を文字列に変換するには
Kernel.#sprintf, String#%,
Integer#to_s
などを使ってください。... -
String
# oct -> Integer (30162.0) -
文字列を 8 進文字列であると解釈して、整数に変換します。
...{
p "-010".oct # => -8
p "-0x10".oct # => -16
p "-0b10".oct # => -2
p "1_0_1x".oct # => 65
//}
@see String#hex, String#to_i, String#to_f,
Kernel.#Integer, Kernel.#Float
逆に、数値を文字列に変換するにはKernel.#sprintf,
String#%, Integer#to_s を使用します。... -
String
# to _ i(base = 10) -> Integer (30162.0) -
文字列を 10 進数表現された整数であると解釈して、整数に変換します。
...する整数。0 か、2〜36 の整数。
@return 整数
このメソッドの逆に数値を文字列に変換するには、
Kernel.#sprintf, String#%, Integer#to_s
を使用します。
String#hex, String#oct, String#to_f,
Kernel.#Integer, Kernel.#Float
も参照してください。... -
String
# rindex(pattern , pos = self . size) -> Integer | nil (30150.0) -
文字列のインデックス pos から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。
...列または正規表現で指定します。
pos が負の場合は、文字列の末尾から数えた位置から探索します。
rindex と String#index とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......い。
//emlist[String#index の場合][ruby]{
p "stringstring".index("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#rindex の場合][ruby]{
p "stringstring".rindex("ing", -......ンデックス
//emlist[例][ruby]{
p "astrochemistry".rindex("str") # => 10
p "character".rindex(?c) # => 5
p "regexprindex".rindex(/e.*x/, 2) # => 1
p "foobarfoobar".rindex("bar", 6) # => 3
p "foobarfoobar".rindex("bar", -6) # => 3
//}
@see String#index... -
String
# =~(other) -> Integer | nil (30126.0) -
正規表現 other とのマッチを行います。 マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。
...が設定されます。
@param other 正規表現もしくは =~ メソッドを持つオブジェクト
@raise TypeError other が文字列の場合に発生します。
//emlist[例][ruby]{
p "string" =~ /str/ # => 0
p "string" =~ /not/ # => nil
p "abcfoo" =~ /foo/ # => 3
//}... -
String
# byteindex(pattern , offset = 0) -> Integer | nil (30126.0) -
文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...'o', -3) # => 1
'foo'.byteindex('o', -4) # => nil
'あいう'.byteindex('う') # => 6
'あいう'.byteindex('う', 3) # => 6
'あいう'.byteindex('う', -3) # => 6
'あいう'.byteindex('う', 1) # offset 1 does not land on character boundary (IndexError)
//}
@see String#index, String#byterindex... -
String
# bytes -> [Integer] (30126.0) -
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
...と同じです)
//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}
ブロックが指定された場合は String#each_byte と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_byte...