別のキーワード
種類
ライブラリ
- English (12)
- ビルトイン (2520)
- base64 (12)
- benchmark (24)
- bigdecimal (12)
- csv (60)
- erb (60)
- etc (12)
- fiddle (12)
-
irb
/ cmd / help (12) - json (84)
-
json
/ add / struct (12) - kconv (12)
- mkmf (12)
-
net
/ http (84) - objspace (24)
- open-uri (60)
- open3 (12)
- openssl (636)
- optparse (180)
- pathname (24)
- psych (48)
- rake (24)
- rbconfig (12)
-
rexml
/ document (204) - rubygems (36)
-
rubygems
/ defaults (12) -
rubygems
/ platform (12) -
rubygems
/ requirement (36) -
rubygems
/ specification (24) - securerandom (8)
- stringio (86)
- strscan (144)
-
test
/ unit (1) - uri (134)
-
webrick
/ httprequest (12) -
webrick
/ httpservlet / cgihandler (12) - win32ole (12)
クラス
- Array (21)
-
Benchmark
:: Tms (12) - BigDecimal (12)
- Binding (7)
- CSV (60)
- Data (3)
- Dir (27)
- ERB (12)
-
Encoding
:: Converter (96) -
Encoding
:: InvalidByteSequenceError (12) -
Encoding
:: UndefinedConversionError (12) - Enumerator (24)
- Exception (8)
- File (36)
-
Gem
:: Platform (12) -
Gem
:: Requirement (36) -
Gem
:: Specification (24) - IO (16)
-
IRB
:: ExtendCommand :: Help (12) -
JSON
:: Parser (12) - MatchData (26)
- Method (12)
- Module (540)
-
Net
:: HTTPGenericRequest (36) - Object (139)
-
OpenSSL
:: ASN1 :: BMPString (24) -
OpenSSL
:: ASN1 :: BitString (24) -
OpenSSL
:: ASN1 :: GeneralString (24) -
OpenSSL
:: ASN1 :: GraphicString (24) -
OpenSSL
:: ASN1 :: IA5String (24) -
OpenSSL
:: ASN1 :: ISO64String (24) -
OpenSSL
:: ASN1 :: NumericString (24) -
OpenSSL
:: ASN1 :: OctetString (24) -
OpenSSL
:: ASN1 :: PrintableString (24) -
OpenSSL
:: ASN1 :: T61String (24) -
OpenSSL
:: ASN1 :: UTF8String (24) -
OpenSSL
:: ASN1 :: UniversalString (24) -
OpenSSL
:: ASN1 :: VideotexString (24) - OptionParser (132)
- Pathname (24)
- Proc (12)
-
Psych
:: Visitors :: YAMLTree (12) -
REXML
:: Attribute (36) -
REXML
:: Attributes (36) -
REXML
:: CData (12) -
REXML
:: DocType (24) -
REXML
:: Document (36) -
REXML
:: Instruction (24) -
REXML
:: Text (24) -
Rake
:: FileList (24) - Random (15)
- Range (33)
- Refinement (4)
- Regexp (48)
- RubyVM (24)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (140) - String (776)
- StringIO (86)
- StringScanner (144)
- Struct (108)
- Symbol (27)
-
Thread
:: Backtrace :: Location (12) - Time (12)
- TrueClass (24)
-
URI
:: MailTo (36) - UnboundMethod (96)
- UncaughtThrowError (11)
-
WEBrick
:: HTTPRequest (12) -
WEBrick
:: HTTPServlet :: CGIHandler (12) -
WIN32OLE
_ VARIANT (12)
モジュール
- Base64 (12)
- Benchmark (12)
-
ERB
:: Util (48) - Etc (12)
- Fiddle (12)
-
GC
:: Profiler (12) - Gem (48)
- JSON (48)
-
JSON
:: Generator :: GeneratorMethods :: String (12) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (12) - Kernel (158)
- Marshal (24)
-
Net
:: HTTPHeader (48) - ObjectSpace (24)
- Open3 (12)
-
OpenSSL
:: ASN1 (312) -
OpenURI
:: Meta (60) -
OptionParser
:: Arguable (48) - Psych (36)
- RbConfig (12)
-
RubyVM
:: AbstractSyntaxTree (10) - SecureRandom (8)
-
Test
:: Unit (1) - URI (98)
オブジェクト
- ENV (12)
キーワード
-
$ OUTPUT _ RECORD _ SEPARATOR (12) - % (26)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- ASN1 (12)
- BMPString (24)
-
BUILD
_ RUBY _ PLATFORM (12) - BitString (24)
- Default (12)
- Enumerator (12)
- FORMAT (24)
- Float (7)
- GeneralString (24)
- GraphicString (24)
- IA5String (24)
-
INSTRUCTION
_ NAMES (12) - ISO64String (24)
- Integer (7)
- Marshal フォーマット (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) - NumericString (24)
- OPTS (12)
- OctetString (24)
- 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)
- STR2CSTR (12)
- StringValue (12)
- StringValuePtr (12)
- T61String (24)
- UTF8String (24)
- UniversalString (24)
- VideotexString (24)
- [] (53)
- []= (24)
-
_ dump (24) -
absolute
_ path (36) -
alias
_ method (12) -
allocation
_ sourcefile (12) - alphanumeric (8)
-
arg
_ config (12) - arity (12)
-
as
_ list (12) - attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) -
attribute
_ of (12) - autoload (24)
- autoload? (24)
-
base
_ label (12) - basename (12)
-
basic
_ auth (12) - bigdecimal (12)
-
bigdecimal
/ util (12) - body (12)
- bytes (14)
- byteslice (36)
- captures (12)
- casecmp (24)
- casecmp? (18)
- charset (24)
-
check
_ until (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) - clone (12)
-
compile
_ option (12) - concat (9)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ set (12) -
const
_ source _ location (12) - content (12)
-
content
_ encoding (12) -
content
_ type (12) - convert (12)
- count (12)
-
count
_ objects _ size (12) -
decode
_ www _ form _ component (12) - deconstruct (2)
- dedup (3)
-
default
_ argv (12) - define (3)
-
define
_ method (24) -
delete
_ suffix (8) -
delete
_ suffix! (8) -
deprecate
_ constant (12) - disasm (24)
- disassemble (24)
- dump (72)
-
dump
_ stream (12) - dup (12)
- each (12)
-
each
_ byte (24) -
each
_ char (12) -
each
_ codepoint (12) -
each
_ grapheme _ cluster (16) -
each
_ line (24) - encode (43)
-
encode
_ www _ form _ component (12) - encoding (12)
-
end
_ with? (6) - eql? (12)
-
error
_ bytes (12) -
error
_ char (12) - escape (7)
- execute (12)
- extract (48)
-
fast
_ unparse (12) - fetch (12)
- filter (24)
- finish (12)
-
force
_ encoding (12) - format (12)
-
get
_ byte (12) - getbyte (12)
- getch (12)
- glob (10)
-
grapheme
_ clusters (16) - gsub (84)
- gsub! (60)
- h (12)
- headers (12)
- home (12)
-
html
_ escape (12) -
import
_ methods (4) - include? (12)
-
insert
_ output (12) - inspect (67)
- instance (24)
-
instance
_ method (12) - iseuc (12)
- label (12)
- length (12)
- lines (7)
- ljust (12)
-
load
_ from _ binary _ extra _ data (10) - match? (12)
-
matched
_ size (12) - method (12)
-
method
_ defined? (12) -
module
_ function (36) - name (24)
-
named
_ captures (12) - namespace (12)
- namespaces (12)
- new (396)
- order! (48)
- pack (21)
- pack テンプレート文字列 (12)
- parse (34)
- parse! (24)
- path (24)
- permute (24)
- permute! (24)
- pipeline (12)
- pread (8)
- prefix (12)
- prefixes (12)
- prepend (9)
-
pretty
_ print (12) -
pretty
_ unparse (12) - private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
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)
- pwrite (8)
- query (12)
- quote (12)
-
quote
_ char (12) -
rb
_ assoc _ new (12) -
rb
_ compile _ string (12) -
rb
_ eval _ string (12) -
rb
_ eval _ string _ protect (12) -
rb
_ jump _ tag (12) -
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) - replacement= (12)
- result (24)
- rjust (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) -
scan
_ full (12) -
scan
_ until (12) - scrub (36)
- scrub! (36)
-
search
_ full (12) -
setup
_ argv (1) - size (12)
-
skip
_ until (12) - slice (12)
- slice! (12)
- source (24)
-
source
_ location (43) - split (12)
- sprintf (12)
- sprintf フォーマット (12)
- squeeze (12)
- squeeze! (12)
-
stand
_ alone? (12) - status (12)
- step (19)
- store (12)
- strftime (12)
- sub (84)
- sub! (48)
-
sub
_ type (12) - succ (12)
- succ! (12)
- sum (12)
-
summary
_ indent (12) - target (12)
- then (7)
-
to
_ a (12) -
to
_ binary (10) -
to
_ json (36) -
to
_ mailtext (12) -
to
_ rfc822text (12) -
to
_ ruby (12) -
to
_ s (71) -
to
_ string (12) - truncate (12)
- uname (12)
-
undef
_ method (12) - undump (8)
- ungetc (12)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - union (12)
- unnormalize (12)
- unpack (12)
- unpack1 (9)
- unparse (12)
- unscan (12)
-
untrace
_ var (12) - upcase (12)
- upcase! (12)
- upto (12)
- urandom (8)
-
url
_ encode (12) -
urlsafe
_ encode64 (12) - value (36)
-
values
_ at (12) - version (12)
-
with
_ object (24) -
yield
_ self (8) - リテラル (12)
- 正規表現 (12)
検索結果
先頭5件
-
String (44246.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 に対してメソッドを呼んだ......ト、ダブルクオートとの併用も可能
<<~End
この行のインデントは無視される
End
//}
===[a:mutable] 破壊的な変更
Ruby の String クラスは mutable です。
つまり、オブジェクト自体を破壊的に変更できます。
「破壊的な変更」とは... -
WEBrick
:: HTTPServlet :: CGIHandler :: Ruby -> String (33535.0) -
Ruby のパスを返します。
...
Ruby のパスを返します。... -
String
# grapheme _ clusters {|grapheme _ cluster| block } -> self (33455.0) -
文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)
...f.each_grapheme_cluster.to_a と同じです)
//emlist[例][ruby]{
"a\u0300".grapheme_clusters # => ["à"]
//}
ブロックが指定された場合は String#each_grapheme_cluster と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は......削除されました。
@see String#each_grapheme_cluster... -
String
# delete _ suffix(suffix) -> String (33443.0) -
文字列の末尾から suffix を削除した文字列のコピーを返します。
...から suffix を削除した文字列のコピーを返します。
@param suffix 末尾から削除する文字列を指定します。
@return 文字列の末尾から suffix を削除した文字列のコピー
//emlist[][ruby]{
"hello".delete_suffix("llo") # => "he"
"hello".delete_suffix("he......l") # => "hello"
//}
@see String#chomp
@see String#chop
@see String#delete_prefix
@see String#delete_suffix!
@see String#end_with?... -
String
# each _ grapheme _ cluster {|grapheme _ cluster| block } -> self (33436.0) -
文字列の書記素クラスタに対して繰り返します。
...。
String#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。
//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}
@see String#g......rapheme_clusters... -
String
# grapheme _ clusters -> [String] (33355.0) -
文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)
...f.each_grapheme_cluster.to_a と同じです)
//emlist[例][ruby]{
"a\u0300".grapheme_clusters # => ["à"]
//}
ブロックが指定された場合は String#each_grapheme_cluster と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は......削除されました。
@see String#each_grapheme_cluster... -
String
# delete _ suffix!(suffix) -> self | nil (33342.0) -
self の末尾から破壊的に suffix を削除します。
...uffix を削除します。
@param suffix 末尾から削除する文字列を指定します。
@return 削除した場合は self、変化しなかった場合は nil
//emlist[][ruby]{
"hello".delete_suffix!("llo") # => "he"
"hello".delete_suffix!("hel") # => nil
//}
@see String#chomp!
@see St......ring#chop!
@see String#delete_prefix!
@see String#delete_suffix
@see String#end_with?... -
String
# ljust(width , padding = & # 39; & # 39;) -> String (33325.0) -
長さ width の文字列に self を左詰めした文字列を返します。 self の長さが width より長い時には元の文字列の複製を返します。 また、第 2 引数 padding を指定したときは 空白文字の代わりに padding を詰めます。
...長さ width の文字列に self を左詰めした文字列を返します。
self の長さが width より長い時には元の文字列の複製を返します。
また、第 2 引数 padding を指定したときは
空白文字の代わりに padding を詰めます。
@param width 返......が width になるまで self の右側に詰める文字
//emlist[例][ruby]{
p "foo".ljust(10) # => "foo "
p "foo".ljust(9) # => "foo "
p "foo".ljust(8) # => "foo "
p "foo".ljust(2) # => "foo"
p "foo".ljust(1) # => "foo"
p "foo".ljust(10, "*"......) # => "foo*******"
//}
@see String#center, String#rjust... -
String
# rjust(width , padding = & # 39; & # 39;) -> String (33325.0) -
長さ width の文字列に self を右詰めした文字列を返します。 self の長さが width より長い時には元の文字列の複製を返します。 また、第 2 引数 padding を指定したときは 空白文字の代わりに padding を詰めます。
...長さ width の文字列に self を右詰めした文字列を返します。
self の長さが width より長い時には元の文字列の複製を返します。
また、第 2 引数 padding を指定したときは
空白文字の代わりに padding を詰めます。
@param width 返......が width になるまで self の左側に詰める文字
//emlist[例][ruby]{
p "foo".rjust(10) # => " foo"
p "foo".rjust(9) # => " foo"
p "foo".rjust(8) # => " foo"
p "foo".rjust(2) # => "foo"
p "foo".rjust(1) # => "foo"
p "foo".rjust(10, "*"......) # => "*******foo"
//}
@see String#center, String#ljust... -
String
# each _ grapheme _ cluster -> Enumerator (33236.0) -
文字列の書記素クラスタに対して繰り返します。
...。
String#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。
//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}
@see String#g......rapheme_clusters... -
String
# upto(max , exclusive = false) {|s| . . . } -> self (33228.0) -
self から始めて max まで 「次の文字列」を順番にブロックに与えて繰り返します。 「次」の定義については String#succ を参照してください。
...「次」の定義については String#succ を参照してください。
たとえば以下のコードは a, b, c, ... z, aa, ... az, ..., za を
出力します。
//emlist[][ruby]{
("a" .. "za").each do |str|
puts str
end
'a'.upto('za') do |str|
puts str
end
//}
@param max 繰り......返しをやめる文字列
@param exclusive max を含むかどうか。false の場合は max を含む。...