別のキーワード
種類
ライブラリ
- English (55)
- ビルトイン (5516)
- abbrev (22)
- base64 (22)
- benchmark (22)
- bigdecimal (71)
-
cgi
/ core (11) - csv (275)
- digest (66)
- erb (88)
- etc (55)
- fiddle (11)
-
irb
/ cmd / help (11) - json (286)
-
json
/ add / bigdecimal (11) -
json
/ add / complex (11) -
json
/ add / date (11) -
json
/ add / date _ time (11) -
json
/ add / exception (11) -
json
/ add / range (11) -
json
/ add / regexp (11) -
json
/ add / time (11) - kconv (22)
- logger (33)
- matrix (22)
- mkmf (88)
-
net
/ http (253) - objspace (22)
- open-uri (57)
- open3 (11)
- openssl (605)
- optparse (418)
- pathname (44)
- psych (72)
- rake (154)
-
rake
/ packagetask (33) - rbconfig (11)
-
rdoc
/ known _ classes (11) - readline (11)
- resolv (22)
-
rexml
/ document (341) - ripper (11)
-
ripper
/ filter (11) -
ripper
/ lexer (66) - rubygems (33)
-
rubygems
/ defaults (11) -
rubygems
/ gem _ path _ searcher (11) -
rubygems
/ installer (22) -
rubygems
/ platform (11) -
rubygems
/ requirement (33) -
rubygems
/ specification (22) -
rubygems
/ version (22) - securerandom (7)
- set (18)
- socket (55)
- stringio (270)
- strscan (495)
-
test
/ unit (1) - uri (113)
-
webrick
/ httprequest (11) -
webrick
/ httpservlet / cgihandler (11) - win32ole (77)
- zlib (11)
クラス
-
ARGF
. class (99) - Addrinfo (11)
- Array (118)
- BasicObject (11)
-
Benchmark
:: Tms (11) - BigDecimal (82)
- Binding (6)
- CGI (11)
- CSV (176)
-
CSV
:: FieldInfo (11) -
CSV
:: Row (11) -
CSV
:: Table (66) - Class (11)
- Complex (33)
- Data (8)
- Date (11)
- DateTime (11)
-
Digest
:: Base (55) - Dir (141)
- ERB (44)
- Encoding (88)
-
Encoding
:: Converter (132) -
Encoding
:: InvalidByteSequenceError (11) -
Encoding
:: UndefinedConversionError (11) - Enumerator (22)
- Exception (73)
- FalseClass (22)
- File (143)
-
File
:: Stat (22) - Float (22)
-
Gem
:: GemPathSearcher (11) -
Gem
:: Installer (22) -
Gem
:: Platform (11) -
Gem
:: Requirement (33) -
Gem
:: Specification (22) -
Gem
:: Version (22) - Hash (22)
- IO (179)
- IPSocket (11)
-
IRB
:: ExtendCommand :: Help (11) - Integer (55)
-
JSON
:: Parser (11) -
JSON
:: State (55) - Logger (33)
- MatchData (88)
- Matrix (11)
- Method (33)
- Module (472)
-
Net
:: HTTPGenericRequest (33) -
Net
:: HTTPResponse (88) - NilClass (6)
- Object (308)
-
OpenSSL
:: ASN1 :: BMPString (22) -
OpenSSL
:: ASN1 :: BitString (22) -
OpenSSL
:: ASN1 :: GeneralString (22) -
OpenSSL
:: ASN1 :: GraphicString (22) -
OpenSSL
:: ASN1 :: IA5String (22) -
OpenSSL
:: ASN1 :: ISO64String (22) -
OpenSSL
:: ASN1 :: NumericString (22) -
OpenSSL
:: ASN1 :: OctetString (22) -
OpenSSL
:: ASN1 :: PrintableString (22) -
OpenSSL
:: ASN1 :: T61String (22) -
OpenSSL
:: ASN1 :: UTF8String (22) -
OpenSSL
:: ASN1 :: UniversalString (22) -
OpenSSL
:: ASN1 :: VideotexString (22) -
OpenSSL
:: BN (11) - OptionParser (374)
- Pathname (44)
- Proc (33)
-
Psych
:: ScalarScanner (11) -
Psych
:: Visitors :: YAMLTree (11) -
REXML
:: Attribute (33) -
REXML
:: Attributes (33) -
REXML
:: CData (22) -
REXML
:: DocType (77) -
REXML
:: Document (33) -
REXML
:: Element (66) -
REXML
:: Entity (22) -
REXML
:: Instruction (22) -
REXML
:: Text (33) -
Rake
:: Application (33) -
Rake
:: FileList (77) -
Rake
:: InvocationChain (11) -
Rake
:: PackageTask (33) - Random (26)
- Range (80)
- Rational (11)
- Refinement (3)
- Regexp (165)
- Resolv (22)
- Ripper (44)
-
Ripper
:: Filter (11) -
Ripper
:: Lexer (33) - RubyVM (11)
-
RubyVM
:: AbstractSyntaxTree :: Node (6) -
RubyVM
:: InstructionSequence (128) - Set (18)
- SignalException (11)
- Socket (33)
- String (1819)
- StringIO (270)
- StringScanner (484)
- Struct (66)
- Symbol (52)
- Thread (38)
-
Thread
:: Backtrace :: Location (66) - Time (71)
- TracePoint (50)
- TrueClass (22)
-
URI
:: MailTo (33) - UnboundMethod (88)
- UncaughtThrowError (10)
- Vector (11)
-
WEBrick
:: HTTPRequest (11) -
WEBrick
:: HTTPServlet :: CGIHandler (11) - WIN32OLE (11)
-
WIN32OLE
_ TYPE (22) -
WIN32OLE
_ TYPELIB (11) -
WIN32OLE
_ VARIANT (22)
モジュール
- Abbrev (11)
- Base64 (22)
- Benchmark (11)
- Digest (11)
-
ERB
:: Util (44) - Etc (55)
- Fiddle (11)
-
GC
:: Profiler (11) - Gem (44)
- JSON (99)
-
JSON
:: Generator :: GeneratorMethods :: Array (11) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (11) -
JSON
:: Generator :: GeneratorMethods :: Float (11) -
JSON
:: Generator :: GeneratorMethods :: Hash (11) -
JSON
:: Generator :: GeneratorMethods :: Integer (11) -
JSON
:: Generator :: GeneratorMethods :: NilClass (11) -
JSON
:: Generator :: GeneratorMethods :: Object (11) -
JSON
:: Generator :: GeneratorMethods :: String (11) -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (11) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (11) - Kconv (11)
- Kernel (728)
- Marshal (22)
-
Net
:: HTTPHeader (132) - ObjectSpace (22)
- Open3 (11)
- OpenSSL (11)
-
OpenSSL
:: ASN1 (286) -
OpenURI
:: Meta (55) -
OptionParser
:: Arguable (44) - Process (22)
- Psych (28)
- RDoc (11)
- Rake (11)
-
Rake
:: TaskManager (22) - RbConfig (11)
- Readline (11)
-
RubyVM
:: AbstractSyntaxTree (8) - SecureRandom (7)
- Signal (22)
-
Test
:: Unit (1) - URI (80)
-
WIN32OLE
:: VARIANT (11) - Zlib (11)
キーワード
-
$ & (11) -
$ & # 39; (11) -
$ * (11) -
$ , (11) -
$ -0 (11) -
$ -F (11) -
$ -I (11) -
$ / (11) -
$ 0 (11) -
$ 1 (11) -
$ 10 (11) -
$ 11 (11) -
$ 2 (11) -
$ 3 (11) -
$ 4 (11) -
$ 5 (11) -
$ 6 (11) -
$ 7 (11) -
$ 8 (11) -
$ 9 (11) -
$ : (11) -
$ ; (11) -
$ ARGV (11) -
$ LAST _ PAREN _ MATCH (11) -
$ LAST _ READ _ LINE (11) -
$ LOAD _ PATH (11) -
$ ORS (11) -
$ OUTPUT _ RECORD _ SEPARATOR (11) -
$ PROGRAM _ NAME (11) -
$ _ (11) -
$ ` (11) -
$ archdir (11) -
$ hdrdir (11) -
$ libdir (11) -
$ sitearchdir (11) -
$ sitelibdir (11) -
$ srcdir (11) -
$ topdir (11) - % (23)
- * (33)
- + (11)
- +@ (9)
- -@ (9)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (22)
- <=> (22)
- == (22)
- === (44)
- =~ (37)
- ASN1 (11)
- BMPString (22)
-
BUILD
_ RUBY _ PLATFORM (11) - BitString (22)
- Complex (11)
- FORMAT (22)
- Float (11)
- GeneralString (22)
- GraphicString (22)
- IA5String (22)
-
INSTRUCTION
_ NAMES (11) - ISO64String (22)
- Integer (11)
-
KNOWN
_ CLASSES (11) - Marshal フォーマット (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - NumericString (22)
- OctetString (22)
- PrintableString (22)
-
RUBY
_ COPYRIGHT (11) -
RUBY
_ DESCRIPTION (11) -
RUBY
_ ENGINE (11) -
RUBY
_ ENGINE _ VERSION (9) -
RUBY
_ PLATFORM (11) -
RUBY
_ RELEASE _ DATE (11) -
RUBY
_ REVISION (5) -
RUBY
_ VERSION (11) - Ruby (11)
- RubyGemsPackageVersion (11)
- RubyGemsVersion (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Rubyの起動 (11)
- Ruby用語集 (11)
- StringScanner (11)
- T61String (22)
- UTF8String (22)
- UniversalString (22)
- VERSION (22)
-
VT
_ BSTR (11) - Version (11)
- VideotexString (22)
- [] (209)
- []= (55)
-
_ _ id _ _ (11) -
_ dump (22) - ` (11)
- abbrev (22)
-
absolute
_ path (33) -
add
_ element (11) -
alias
_ method (11) -
allocation
_ sourcefile (11) - alphanumeric (7)
-
arg
_ config (11) - argv0 (11)
- arity (11)
-
array
_ nl (11) -
as
_ list (11) -
asciicompat
_ encoding (22) - asctime (11)
- attr (33)
-
attr
_ accessor (11) -
attr
_ reader (11) -
attr
_ writer (11) -
attribute
_ of (11) - autoload (22)
- autoload? (22)
- backtrace (22)
-
base
_ label (22) - basename (11)
-
basic
_ auth (11) -
beginning
_ of _ line? (11) - bigdecimal (11)
- binread (22)
- binwrite (11)
- body (22)
- bol? (11)
- byteindex (2)
- byterindex (2)
- bytes (53)
- bytesize (11)
- byteslice (33)
- caller (33)
- canonname (11)
- capitalize (11)
- capitalize! (11)
- captures (11)
- casecmp (22)
- casecmp? (16)
- center (11)
- charpos (11)
- chars (22)
- charset (22)
- check (11)
-
check
_ until (11) - children (20)
- chomp (11)
- chomp! (11)
- chop (11)
- chop! (11)
- chr (33)
- class (11)
-
class
_ variable _ defined? (11) -
class
_ variable _ get (11) -
class
_ variable _ set (11) - clear (22)
- clone (33)
- closed? (11)
- code (11)
- codepage (11)
- codepoints (22)
- coerce (11)
-
col
_ sep (11) - compile (11)
-
compile
_ option (11) - concat (30)
- confstr (11)
- connect (11)
-
const
_ defined? (11) -
const
_ get (11) -
const
_ set (11) -
const
_ source _ location (5) - content (11)
-
content
_ encoding (11) -
content
_ type (22) - convert (11)
- count (11)
-
count
_ objects _ size (11) - cover? (17)
-
create
_ id (11) - ctime (11)
-
datetime
_ format (11) -
decode
_ www _ form _ component (11) - dedup (2)
-
default
_ argv (11) - define (4)
-
define
_ method (22) -
define
_ singleton _ method (22) - delete (44)
- delete! (11)
-
delete
_ prefix (7) -
delete
_ prefix! (7) -
delete
_ suffix (7) -
delete
_ suffix! (7) -
deprecate
_ constant (9) - dev (11)
- digest (11)
- digest! (11)
- dirname (11)
- disasm (22)
- disassemble (22)
- downcase (11)
- downcase! (11)
- dummy? (11)
- dump (11)
-
dump
_ stream (11) - dup (22)
- each (22)
-
each
_ byte (44) -
each
_ char (22) -
each
_ codepoint (22) -
each
_ grapheme _ cluster (14) -
each
_ line (44) - empty? (22)
- encode (40)
- encode! (22)
- encode64 (11)
-
encode
_ www _ form _ component (11) - encoding (22)
-
end
_ with? (16) - entities (11)
- entity (22)
- entries (22)
- environment (11)
- eos? (11)
- eql? (22)
-
error
_ bytes (11) -
error
_ char (11) - escape (18)
-
eval
_ script (6) -
exec
_ format (11) - execute (11)
- exist? (11)
- ext (11)
-
external
_ id (11) - extname (11)
- extract (44)
-
fast
_ generate (11) -
fast
_ unparse (11) - fetch (33)
- filename (44)
- filename= (11)
- find (11)
- finish (11)
-
for
_ fd (11) -
force
_ encoding (11) - format (11)
-
formatted
_ program _ filename (11) - formatter (11)
- freeze (11)
- ftype (22)
- generate (22)
-
generate
_ line (11) -
get
_ byte (11) -
get
_ fields (11) - getaddress (22)
- getaddrinfo (11)
- getbyte (33)
- getc (22)
- getch (11)
- gethostname (11)
- getlogin (11)
- getname (11)
- gets (66)
- getwd (11)
- glob (22)
-
grapheme
_ clusters (14) - gsub (77)
- gsub! (55)
- h (11)
- hash (22)
- header (22)
- headers (11)
- help (11)
- helpfile (11)
- hex (11)
- hexdigest (11)
- hexdigest! (11)
- hexencode (11)
- home (22)
-
html
_ escape (11) -
http
_ version (11) -
import
_ methods (3) - include? (11)
- indent (11)
- index (11)
-
inplace
_ mode (11) - insert (11)
-
insert
_ output (11) - inspect (365)
- instance (22)
-
instance
_ method (11) - intern (11)
- irb (11)
-
is
_ a? (11) - iseuc (11)
- isjis (11)
- itself (11)
- join (22)
-
json
_ creatable? (11) -
json
_ create (11) -
kind
_ of? (11) - label (22)
-
last
_ comment (11) -
last
_ description (11) -
last
_ match (22) - length (11)
- lex (22)
-
lib
_ dirs _ for (11) - lines (36)
- load (11)
-
load
_ from _ binary _ extra _ data (9) -
locale
_ charmap (11) - logger (11)
- lstrip! (11)
-
main
_ type (11) - match (22)
- match? (27)
- matched (11)
- matched? (11)
-
matched
_ size (11) - matches? (11)
- method (33)
-
method
_ defined? (11) -
module
_ function (19) - msg (11)
- name (70)
- name= (9)
-
name
_ list (11) -
named
_ captures (11) - names (33)
- namespace (22)
- namespaces (22)
- new (468)
- next (11)
- next! (11)
-
object
_ nl (11) - oct (11)
- on (132)
- open (90)
- ord (22)
- order (44)
- order! (44)
-
original
_ dir (22) - pack (19)
- pack テンプレート文字列 (11)
-
package
_ dir (11) -
package
_ dir _ path (11) - parse (41)
- parse! (22)
-
parse
_ csv (11) - partition (11)
- path (88)
- pathmap (11)
- peek (11)
- peep (11)
- permute (22)
- permute! (22)
- pipeline (11)
- pointer (11)
- pointer= (11)
- pos (11)
- pos= (11)
-
post
_ match (11) - pp (11)
-
pre
_ match (22) - pread (7)
- prefix (11)
- prefixes (22)
- prepend (19)
-
pretty
_ generate (11) -
pretty
_ print (11) -
pretty
_ unparse (11) - private (23)
-
private
_ class _ method (15) -
private
_ constant (11) -
private
_ method _ defined? (11) - progname (11)
-
program
_ name (11) -
protected
_ method _ defined? (11) -
proxy
_ basic _ auth (11) -
psych
_ y (11) - public (34)
-
public
_ class _ method (15) -
public
_ constant (11) -
public
_ instance _ method (11) -
public
_ method (11) -
public
_ method _ defined? (11) - putback (22)
- pwd (11)
- pwrite (7)
- query (11)
- quote (11)
-
quote
_ char (11) - rakefile (11)
-
raw
_ seed (2) - read (22)
-
read
_ body (22) - readbyte (11)
- readchar (22)
- readline (44)
- readlines (88)
- readlink (11)
- realpath (11)
- release (11)
-
remove
_ class _ variable (11) -
remove
_ const (11) -
remove
_ method (11) - reopen (22)
- replace (11)
- replacement (11)
- replacement= (11)
- reset (11)
- rest (11)
- rest? (11)
-
rest
_ size (11) - restore (11)
- restsize (11)
- result (22)
- reverse (11)
- reverse! (11)
- rindex (11)
-
row
_ sep (11) - rpartition (11)
- rstrip! (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) -
ruby
_ engine (11) -
rubygems
/ commands / cert _ command (11) -
rubygems
/ commands / list _ command (11) -
rubygems
/ commands / search _ command (11) -
rubygems
/ security (11) -
rubygems
_ version (11) -
safe
_ load (17) - scan (33)
-
scan
_ full (11) -
scan
_ until (11) - scrub (33)
- scrub! (33)
-
search
_ full (11) -
set
_ backtrace (11) - setbyte (11)
- setproctitle (11)
-
setup
_ argv (1) - shift (11)
- signm (11)
-
singleton
_ class (11) -
singleton
_ method (11) - size (11)
- skip (11)
-
skip
_ until (11) - slice (77)
- slice! (66)
- socket (11)
- source (22)
-
source
_ location (39) - space (11)
-
space
_ before (11) - split (39)
- sprintf (11)
- sprintf フォーマット (11)
- squeeze (11)
- squeeze! (11)
- src (11)
-
stand
_ alone? (11) -
start
_ with? (12) - status (11)
- step (18)
- store (11)
- strftime (11)
- string (11)
- strip! (11)
- sub (77)
- sub! (44)
-
sub
_ type (11) - succ (11)
- succ! (11)
- sum (11)
-
summary
_ indent (11) - swapcase (11)
- swapcase! (11)
- sysconfdir (11)
- system (11)
- systmpdir (11)
- syswrite (11)
- tainted? (6)
- target (11)
- terminate (11)
- text (11)
- then (12)
-
to
_ a (11) -
to
_ binary (9) -
to
_ c (11) -
to
_ csv (11) -
to
_ f (11) -
to
_ i (11) -
to
_ json (187) -
to
_ mailtext (11) -
to
_ path (11) -
to
_ r (11) -
to
_ rfc822text (11) -
to
_ ruby (11) -
to
_ s (400) -
to
_ str (11) -
to
_ string (11) -
to
_ sym (11) - tokenize (33)
- tr (11)
-
tr
_ s (11) -
tr
_ s! (11) - trace (11)
-
trace
_ var (33) - trap (22)
- truncate (11)
-
try
_ convert (22) - typelibs (11)
- u (11)
- uname (11)
-
undef
_ method (11) - ungetc (11)
-
unicode
_ normalize (10) -
unicode
_ normalize! (10) -
unicode
_ normalized? (10) - union (11)
- unnormalize (11)
- unpack (11)
- unpack1 (8)
- unparse (11)
- unscan (11)
-
untrace
_ var (11) - upcase (11)
- upcase! (11)
- upto (11)
- urandom (7)
-
url
_ encode (11) -
urlsafe
_ encode64 (11) - using (11)
-
valid
_ encoding? (11) - value (33)
-
values
_ at (11) - ver (16)
- version (22)
-
webrick
/ cgi (11) -
with
_ object (22) - write (33)
- xpath (11)
- y (11)
-
yield
_ self (14) - zone (11)
- クラス/メソッドの定義 (11)
- パターンマッチ (11)
- リテラル (11)
- 多言語化 (11)
- 正規表現 (11)
検索結果
先頭5件
- String
- String
. new(string = "" , encoding: string . encoding , capacity: string . bytesize) -> String - String
. new(string = "" , encoding: string . encoding , capacity: 127) -> String - String
. new(string = "" , encoding: string . encoding , capacity: 63) -> String - String
. new(string = "" , encoding: string . encoding) -> String
-
String (38318.0)
-
文字列のクラスです。 ヌル文字を含む任意のバイト列を扱うことができます。 文字列の長さにはメモリ容量以外の制限はありません。
...す。
以下に文字列リテラルの例をいくつか示します。
//emlist[文字列リテラルの例][ruby]{
'str\\ing' # シングルクオート文字列 (エスケープシーケンスがほぼ無効)
"string\n" # ダブルクオート文字列 (エスケープシーケンスがす......
End
# シングルクオートヒアドキュメント (一切のエスケープシーケンスが無効)
<<'End'
この行はヒアドキュメント
End
# 終端記号がインデントされたヒアドキュメント
# シングルクオート、ダブルクオートとの併用も可能
<<-E......nd
この行はヒアドキュメント (終端記号をインデントできる)
End
//}
===[a:mutable] 破壊的な変更
Ruby の String クラスは mutable です。
つまり、オブジェクト自体を破壊的に変更できます。
「破壊的な変更」とは、あるオブジ......できる)
End
# 中身がインデントされたヒアドキュメント
# シングルクオート、ダブルクオートとの併用も可能
<<~End
この行のインデントは無視される
End
//}
===[a:mutable] 破壊的な変更
Ruby の String クラスは mutable です。
つ... -
String
. new(string = "" , encoding: string . encoding , capacity: string . bytesize) -> String (27709.0) -
string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。
...
string と同じ内容の新しい文字列を作成して返します。
引数を省略した場合は空文字列を生成して返します。
@param string 文字列
@param encoding 作成する文字列のエンコーディングを文字列か
Encoding オブジェクト......、引数stringのバイト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)......# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}... -
String
. new(string = "" , encoding: string . encoding , capacity: 127) -> String (27609.0) -
string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。
...
string と同じ内容の新しい文字列を作成して返します。
引数を省略した場合は空文字列を生成して返します。
@param string 文字列
@param encoding 作成する文字列のエンコーディングを文字列か
Encoding オブジェクト......、引数stringのバイト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)......# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}... -
String
. new(string = "" , encoding: string . encoding , capacity: 63) -> String (27609.0) -
string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。
...
string と同じ内容の新しい文字列を作成して返します。
引数を省略した場合は空文字列を生成して返します。
@param string 文字列
@param encoding 作成する文字列のエンコーディングを文字列か
Encoding オブジェクト......、引数stringのバイト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)......# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}... -
String
. new(string = "" , encoding: string . encoding) -> String (27581.0) -
string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。
...
string と同じ内容の新しい文字列を作成して返します。
引数を省略した場合は空文字列を生成して返します。
@param string 文字列
@param encoding 作成する文字列のエンコーディングを文字列か
Encoding オブジェクト......数 string のエンコーディングと同
じになります(ただし、string が指定されていなかった場合は
Encoding::ASCII_8BITになります)。
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text......"hoge".encode("EUC-JP")
no_option = String.new(text) # => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
//}... -
String
# encode(encoding , from _ encoding , **options) -> String (27563.0) -
self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。
...self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、En...... Encoding::UndefinedConversionError を投げます。(デフォルト)
: :undef => :replace
変換先のエンコーディングにおいて文字が定義されていない場合に、未定義文字を置換文字で置き換えます。
: :replace => string
前述の :invalid => :replace や......crlf_newline => true
LF 改行を CRLF 改行に置き換えます。(CRLF は CRCRLF になります)
これ以上細かい指定を行いたい場合は、Encoding::Converter#convert を用いましょう。
//emlist[例][ruby]{
#coding:UTF-8
s = "いろは"
s.encode("EUC-JP")
s.encode(Encodin... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (27514.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(... -
String
. new(string = "") -> String (27509.0) -
string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。
...
string と同じ内容の新しい文字列を作成して返します。
引数を省略した場合は空文字列を生成して返します。
@param string 文字列
@param encoding 作成する文字列のエンコーディングを文字列か
Encoding オブジェクト......数 string のエンコーディングと同
じになります(ただし、string が指定されていなかった場合は
Encoding::ASCII_8BITになります)。
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text......"hoge".encode("EUC-JP")
no_option = String.new(text) # => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
//}......、引数stringのバイト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)......# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}... -
String
# encode(encoding , **options) -> String (27463.0) -
self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。
...self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、En...... Encoding::UndefinedConversionError を投げます。(デフォルト)
: :undef => :replace
変換先のエンコーディングにおいて文字が定義されていない場合に、未定義文字を置換文字で置き換えます。
: :replace => string
前述の :invalid => :replace や......crlf_newline => true
LF 改行を CRLF 改行に置き換えます。(CRLF は CRCRLF になります)
これ以上細かい指定を行いたい場合は、Encoding::Converter#convert を用いましょう。
//emlist[例][ruby]{
#coding:UTF-8
s = "いろは"
s.encode("EUC-JP")
s.encode(Encodin... -
String
# parse _ csv(**options) -> [String] (27457.0) -
CSV.parse_line(self, options) と同様です。
...CSV.parse_line(self, options) と同様です。
1 行の CSV 文字列を、文字列の配列に変換するためのショートカットです。
@param options CSV.new と同様のオプションを指定します。
//emlist[][ruby]{
require "csv"
p "Matz,Ruby\n".parse_csv......Ruby"]
p "Matz|Ruby\r\n".parse_csv(col_sep: '|', row_sep: "\r\n") # => ["Matz", "Ruby"]
//}
Ruby 2.6 (CSV 3.0.2) から、次のオプションが使えるようになりました。
//emlist[][ruby]{
require 'csv'
p "1,,3\n".parse_csv # => ["1", nil, "3"]
p "1,,3\n".parse......lue: Float::NAN) # => ["1", NaN, "3"]
//}
Ruby 2.7 (CSV 3.1.2) から、次のオプションが使えるようになりました。
//emlist[][ruby]{
require 'csv'
p "Matz, Ruby\n".parse_csv # => ["Matz", " Ruby"]
p "Matz, Ruby\n".parse_csv(strip: true) # => ["Matz", "Ruby"]... -
String
. new(string = "") -> String (27454.0) -
string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。
...
string と同じ内容の新しい文字列を作成して返します。
引数を省略した場合は空文字列を生成して返します。
@param string 文字列
@return 引数 string と同じ内容の文字列オブジェクト
//emlist[例][ruby]{
text = "hoge".encode("EUC-J......P")
no_option = String.new(text) # => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
//}... -
Gem
. # ruby -> String (27435.0) -
実行中のRubyインタプリタのパスを返します。
...実行中のRubyインタプリタのパスを返します。... -
Gem
:: Platform :: RUBY -> String (27435.0) -
Pure Ruby の Gem はバイナリファイルをビルドするために Gem::Specification#extensions を使用する可能性があります。
...Pure Ruby の Gem はバイナリファイルをビルドするために Gem::Specification#extensions
を使用する可能性があります。... -
String
# encode!(encoding , from _ encoding , options = nil) -> self (27430.0) -
self を指定したエンコーディングに変換し、自身を置き換えます。引数を2つ 与えた場合、第二引数は変換元のエンコーディングを意味します。さもなくば self のエンコーディングが使われます。変換後の self を返します。
...self を指定したエンコーディングに変換し、自身を置き換えます。引数を2つ
与えた場合、第二引数は変換元のエンコーディングを意味します。さもなくば
self のエンコーディングが使われます。変換後の self を返します。...... Encoding オブジェクトを指定します。
@param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@return 変換後のself
//emlist[例][ruby]{
#coding:UTF-8
s = "いろは"
s.encode!("EUC-JP")
s.encode!(......Encoding::UTF_8)
//}
@see String#encode...