別のキーワード
種類
ライブラリ
- ビルトイン (2951)
- abbrev (24)
- base64 (24)
- benchmark (24)
- bigdecimal (77)
- csv (108)
- digest (72)
- erb (96)
- etc (12)
- fiddle (12)
-
irb
/ cmd / help (12) - json (180)
-
json
/ add / bigdecimal (12) -
json
/ add / exception (12) - kconv (24)
- logger (12)
- mkmf (36)
-
net
/ http (96) - objspace (24)
- openssl (168)
- optparse (312)
- pathname (36)
- psych (79)
- rake (60)
- rbconfig (36)
-
rexml
/ document (168) -
ripper
/ lexer (36) - rubygems (36)
-
rubygems
/ defaults (12) -
rubygems
/ gem _ path _ searcher (12) -
rubygems
/ platform (12) -
rubygems
/ specification (24) - stringio (134)
- strscan (180)
- uri (38)
-
webrick
/ httprequest (12) -
webrick
/ httpservlet / cgihandler (12) - win32ole (48)
- zlib (12)
クラス
-
ARGF
. class (12) - Array (45)
- BasicObject (12)
-
Benchmark
:: Tms (12) - BigDecimal (89)
- Binding (7)
- CSV (36)
-
CSV
:: Table (72) - Class (12)
- Data (3)
-
Digest
:: Base (60) - Dir (36)
- ERB (48)
-
Encoding
:: Converter (72) -
Encoding
:: InvalidByteSequenceError (12) - Enumerator (24)
- Exception (44)
- File (48)
-
Gem
:: GemPathSearcher (12) -
Gem
:: Platform (12) -
Gem
:: Specification (24) - IO (80)
-
IRB
:: ExtendCommand :: Help (12) - Integer (24)
-
JSON
:: State (48) - Logger (12)
- MatchData (24)
- Method (12)
- Module (376)
-
Net
:: HTTPGenericRequest (12) -
Net
:: HTTPResponse (48) - Object (337)
-
OpenSSL
:: ASN1 :: BMPString (24) -
OpenSSL
:: ASN1 :: BitString (24) -
OpenSSL
:: ASN1 :: PrintableString (24) -
OpenSSL
:: BN (12) - OptionParser (264)
- Pathname (36)
-
Psych
:: ScalarScanner (12) -
Psych
:: Visitors :: YAMLTree (12) -
REXML
:: Attribute (36) -
REXML
:: Attributes (36) -
REXML
:: DocType (24) -
REXML
:: Element (60) -
REXML
:: Entity (12) -
Rake
:: FileList (60) - Random (19)
- Regexp (48)
- Ripper (12)
-
Ripper
:: Lexer (24) - RubyVM (24)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (140) - String (1036)
- StringIO (134)
- StringScanner (180)
- Struct (36)
- Symbol (59)
- Thread (32)
-
Thread
:: Backtrace :: Location (72) - Time (12)
- TracePoint (24)
- UnboundMethod (96)
-
WEBrick
:: HTTPRequest (12) -
WEBrick
:: HTTPServlet :: CGIHandler (12) -
WIN32OLE
_ TYPE (12) -
WIN32OLE
_ TYPELIB (12) -
WIN32OLE
_ VARIANT (12)
モジュール
- Abbrev (12)
- Base64 (24)
- Benchmark (12)
- Digest (12)
-
ERB
:: Util (48) - Etc (12)
- Fiddle (12)
- Gem (48)
- JSON (108)
-
JSON
:: Generator :: GeneratorMethods :: Object (12) - Kconv (12)
- Kernel (180)
- Marshal (48)
-
Net
:: HTTPHeader (36) - ObjectSpace (24)
-
OpenSSL
:: ASN1 (72) -
OptionParser
:: Arguable (48) - Psych (55)
- RbConfig (36)
-
RubyVM
:: AbstractSyntaxTree (10) - URI (38)
-
WIN32OLE
:: VARIANT (12) - Zlib (12)
キーワード
-
$ libdir (12) -
$ sitelibdir (12) - % (12)
- + (12)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - <=> (12)
- == (24)
- === (36)
- =~ (9)
- ASN1 (12)
- BMPString (24)
-
BUILD
_ RUBY _ PLATFORM (12) - BitString (24)
- FORMAT (24)
-
INSTRUCTION
_ NAMES (12) - Integer (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 3
. 1 . 0 (4) - OPTS (12)
- PrintableString (24)
- RSTRING (12)
- RUBY (12)
-
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) - RubyGemsPackageVersion (12)
- RubyGemsVersion (12)
- Rubyの起動 (7)
- TOPDIR (12)
- VERSION (12)
-
VT
_ BSTR (12) - [] (156)
- []= (24)
-
_ _ id _ _ (12) -
_ dump (24) - abbrev (24)
-
absolute
_ path (36) -
alias
_ method (4) -
allocation
_ sourcefile (12) -
arg
_ config (12) - arity (12)
- attr (12)
-
attr
_ accessor (4) -
attr
_ reader (4) -
attr
_ writer (4) -
attribute
_ of (12) - backtrace (24)
-
base
_ label (24) - basename (12)
-
basic
_ auth (12) -
beginning
_ of _ line? (12) - bigdecimal (12)
-
bigdecimal
/ util (12) - binread (24)
- binwrite (12)
- body (24)
- bol? (12)
- byteindex (3)
- byterindex (3)
- bytes (57)
- bytesize (12)
- byteslice (36)
- casecmp (12)
- casecmp? (18)
- chars (12)
- class (12)
-
class
_ variable _ get (12) -
class
_ variable _ set (12) - clone (24)
- closed? (12)
- codepoints (12)
- coerce (12)
-
compile
_ option (12) -
const
_ defined? (12) -
const
_ get (12) -
const
_ set (12) -
const
_ source _ location (12) - convert (12)
-
count
_ objects _ size (12) -
create
_ id (12) -
decode
_ www _ form _ component (12) - define (3)
-
define
_ method (24) -
define
_ singleton _ method (24) - digest (12)
- digest! (12)
- disasm (24)
- disassemble (24)
- dump (72)
-
dump
_ stream (12) - dup (12)
-
each
_ byte (48) -
each
_ char (12) -
each
_ codepoint (12) -
each
_ grapheme _ cluster (8) - empty? (24)
- encode (43)
- encode64 (12)
-
encode
_ www _ form _ component (12) -
end
_ with? (18) - entity (12)
- eos? (12)
- eql? (24)
-
error
_ bytes (12) - escape (7)
- execute (12)
-
fast
_ generate (12) -
fast
_ unparse (12) - filename (12)
- filename= (12)
- finish (12)
-
for
_ fd (12) - format (12)
- formatter (12)
- freeze (12)
- generate (12)
-
get
_ byte (12) - getbyte (36)
- getc (12)
- getch (12)
- gets (12)
- glob (24)
-
grapheme
_ clusters (8) - gsub (84)
- gsub! (60)
- h (12)
- hash (12)
- hexdigest (12)
- hexdigest! (12)
- hexencode (12)
-
html
_ escape (12) - include? (12)
-
insert
_ output (12) - inspect (121)
- instance (12)
-
instance
_ method (12) - intern (12)
-
is
_ a? (12) - iseuc (12)
- isjis (12)
- itself (12)
- join (12)
-
json
_ creatable? (12) -
kind
_ of? (12) - label (24)
-
last
_ match (24) - lex (24)
-
lib
_ dirs _ for (12) - load (12)
-
load
_ from _ binary _ extra _ data (10) - match (12)
- match? (30)
- matched? (12)
-
matched
_ size (12) - matches? (12)
- method (12)
-
method
_ defined? (12) -
module
_ function (12) - name (29)
- namespace (24)
- namespaces (24)
- new (129)
- next (12)
- next! (12)
-
object
_ nl (12) -
object
_ nl= (12) - oct (12)
- on (144)
- open (60)
- order (48)
- order! (48)
- pack (21)
- pack テンプレート文字列 (12)
- parse (22)
- parse! (12)
- path (36)
- peek (12)
- peep (12)
- permute (24)
- permute! (24)
- pread (8)
- prefix (12)
- prefixes (24)
-
pretty
_ generate (12) -
pretty
_ unparse (12) - print (12)
- printf (12)
- private (48)
-
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
proxy
_ basic _ auth (12) - public (24)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) - putback (24)
- puts (12)
- query (12)
-
rb
_ assoc _ new (12) -
rb
_ compile _ string (12) -
rb
_ eval _ string (12) -
rb
_ eval _ string _ protect (12) -
rb
_ jump _ tag (12) - rdoc (12)
-
read
_ body (24) - readbyte (12)
- readline (12)
- readlines (12)
- realpath (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) - replacement= (12)
- rest? (12)
- restore (12)
- result (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
ruby
_ engine (12) -
rubygems
/ commands / cert _ command (12) -
rubygems
/ commands / list _ command (12) -
rubygems
/ security (12) -
rubygems
_ version (12) -
safe
_ load (19) - scan (24)
-
scan
_ full (12) - scrub (36)
- scrub! (36)
-
search
_ full (12) -
set
_ backtrace (12) - setbyte (12)
-
singleton
_ class (12) -
singleton
_ method (12) - slice (72)
- slice! (12)
-
source
_ location (19) -
space
_ before (12) -
space
_ before= (12) - split (31)
- sprintf (12)
- sprintf フォーマット (12)
- src (12)
-
start
_ with? (18) - strftime (12)
- sub (84)
- sub! (48)
-
sub
_ type (12) - succ (12)
- succ! (12)
- sum (12)
- tainted? (6)
- text (12)
- then (14)
-
to
_ binary (10) -
to
_ csv (12) -
to
_ i (12) -
to
_ json (36) -
to
_ ruby (12) -
to
_ s (158) -
to
_ str (12) -
to
_ string (12) -
to
_ sym (12) - tokenize (12)
- trace (12)
-
try
_ convert (24) - typelibs (12)
- u (12)
- uname (12)
-
undef
_ method (12) -
unicode
_ normalized? (11) - union (12)
- unpack (12)
- unpack1 (9)
- unparse (12)
-
untrace
_ var (12) - upto (12)
-
url
_ encode (12) -
urlsafe
_ encode64 (12) -
valid
_ encoding? (12) - value (12)
-
values
_ at (12) - ver (5)
-
with
_ object (24) - write (12)
- xpath (12)
- yaml (12)
-
yield
_ self (16) - パターンマッチ (12)
- リテラル (12)
- 正規表現 (12)
検索結果
先頭5件
-
String (44294.0)
-
文字列のクラスです。 ヌル文字を含む任意のバイト列を扱うことができます。 文字列の長さにはメモリ容量以外の制限はありません。
...つか示します。
//emlist[文字列リテラルの例][ruby]{
'str\\ing' # シングルクオート文字列 (エスケープシーケンスがほぼ無効)
"string\n" # ダブルクオート文字列 (エスケープシーケンスがすべて有効)
%q(str\\ing) # 「%q」文字列 (エ......用も可能
<<-End
この行はヒアドキュメント (終端記号をインデントできる)
End
//}
===[a:mutable] 破壊的な変更
Ruby の String クラスは mutable です。
つまり、オブジェクト自体を破壊的に変更できます。
「破壊的な変更」とは......文字へ変更する
String#upcase! メソッドの使用例を以下に示します。
//emlist[例:String#upcase!][ruby]{
a = "string"
b = a
a.upcase!
p a # => "STRING"
p b # => "STRING"
//}
この例では、a に対してメソッドを呼んだにも関わらず b も変更されてい......、ダブルクオートとの併用も可能
<<~End
この行のインデントは無視される
End
//}
===[a:mutable] 破壊的な変更
Ruby の String クラスは mutable です。
つまり、オブジェクト自体を破壊的に変更できます。
「破壊的な変更」とは、... -
String
# b -> String (42320.0) -
self の文字エンコーディングを ASCII-8BIT にした文字列の複製を返します。
...self の文字エンコーディングを ASCII-8BIT にした文字列の複製を返します。
//emlist[例][ruby]{
'abc123'.encoding # => #<Encoding:UTF-8>
'abc123'.b.encoding # => #<Encoding:ASCII-8BIT>
//}... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (33666.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...イト単位のインデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。
引数 pattern は探索する部分文字列ま......たは正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探......//emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex... -
WEBrick
:: HTTPServlet :: CGIHandler :: Ruby -> String (33535.0) -
Ruby のパスを返します。
...
Ruby のパスを返します。... -
String
# bytes {|byte| . . . } -> self (33448.0) -
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
...h_byte.to_a と同じです)
//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}
ブロックが指定された場合は String#each_byte と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#......each_byte... -
String
# byteindex(pattern , offset = 0) -> Integer | nil (33424.0) -
文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...文字列の offset から右に向かって pattern を検索し、
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。
引数 pattern は探索する部分文字列または正規表現で指定......pattern 探索する部分文字列または正規表現
@param offset 探索を開始するバイト単位のオフセット
@raise IndexError オフセットが文字列の境界以外をさしているときに発生します。
//emlist[例][ruby]{
'foo'.byteindex('f') # => 0
'foo'.byte......=> 1
'foo'.byteindex('oo') # => 1
'foo'.byteindex('ooo') # => nil
'foo'.byteindex(/f/) # => 0
'foo'.byteindex(/o/) # => 1
'foo'.byteindex(/oo/) # => 1
'foo'.byteindex(/ooo/) # => nil
'foo'.byteindex('o', 1) # => 1
'foo'.byteindex('o', 2) # => 2
'foo'.byteindex('o', 3) # => nil
'foo'.byteindex('o'... -
String
# each _ byte {|byte| . . . } -> self (33418.0) -
文字列の各バイトに対して繰り返します。
...文字列の各バイトに対して繰り返します。
//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114
"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}
@see String#bytes... -
String
# bytes -> [Integer] (33348.0) -
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
...h_byte.to_a と同じです)
//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}
ブロックが指定された場合は String#each_byte と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#......each_byte... -
String
# byteslice(nth , len=1) -> String | nil (33334.0) -
nth バイト目から長さ len バイトの部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は nil を返します。
...nth バイト目から長さ len バイトの部分文字列を新しく作って返します。
nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は
nil を返します。
@param nth 取得したい文字列の開始バイトを整数で指定し......。
@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 (33334.0) -
range で指定したバイトの範囲に含まれる部分文字列を返します。引数が範囲 外を指定した場合は nil を返します。
...ェクト
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1..2) # => "el"
"\x03\u3042\xff".byteslice(1..3) # => "\u3042"
//}
@see String#slice
@see String#bytesplice... -
String
# byteslice(nth) -> String | nil (33329.0) -
nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。 引数が範囲外を指定した場合は nil を返します。
...nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。
引数が範囲外を指定した場合は nil を返します。
@param nth 文字の位置を表す整数を指定します。
@return 切り出した文字列を返します。戻り値の......文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1) # => "e"
"hello".byteslice(-1) # => "o"
"\u3042".byteslice(0) # => "\xE3"
"\u3042".byteslice(1) # => "\x81"
//}
@see String#slice... -
String
# byteslice(nth , len=1) -> String | nil (33327.0) -
nth バイト目から長さ len バイトの部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は nil を返します。
...nth バイト目から長さ len バイトの部分文字列を新しく作って返します。
nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は
nil を返します。
@param nth 取得したい文字列の開始バイトを整数で指定し......数で指定します。
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1, 2) # => "el"
"\u3042\u3044\u3046".byteslice(0, 3) # => "\u3042"
//}
@see String#slice...