種類
ライブラリ
- ビルトイン (1786)
- abbrev (12)
- benchmark (36)
- bigdecimal (24)
-
cgi
/ core (396) -
cgi
/ html (48) -
cgi
/ util (24) - csv (60)
- date (24)
- dbm (84)
- etc (240)
- fiddle (12)
- gdbm (72)
-
irb
/ ext / save-history (12) - json (48)
-
json
/ add / date (12) -
json
/ add / date _ time (12) -
json
/ add / symbol (12) - logger (24)
- mkmf (12)
-
net
/ ftp (92) -
net
/ http (288) -
net
/ imap (432) -
net
/ smtp (44) - open-uri (12)
- open3 (24)
- openssl (744)
- optparse (36)
- pathname (12)
- pp (36)
- prettyprint (12)
- pstore (36)
- psych (343)
- rake (60)
- rbconfig (12)
- readline (108)
- resolv (36)
-
rexml
/ document (348) -
ripper
/ lexer (36) - rubygems (36)
-
rubygems
/ command (12) -
rubygems
/ commands / dependency _ command (36) -
rubygems
/ config _ file (12) -
rubygems
/ defaults (24) -
rubygems
/ dependency (24) -
rubygems
/ indexer (24) -
rubygems
/ package / tar _ header (12) -
rubygems
/ package / tar _ input (12) -
rubygems
/ package / tar _ reader / entry (36) -
rubygems
/ platform (12) -
rubygems
/ requirement (12) -
rubygems
/ security (12) -
rubygems
/ source _ info _ cache (60) -
rubygems
/ specification (60) - scanf (36)
- sdbm (84)
- securerandom (12)
- shell (12)
-
shell
/ command-processor (6) -
shell
/ filter (6) -
shell
/ system-command (24) - shellwords (36)
- socket (108)
- stringio (194)
- strscan (72)
- syslog (36)
-
syslog
/ logger (24) - uri (36)
-
webrick
/ accesslog (12) -
webrick
/ httprequest (72) -
webrick
/ httpresponse (24) -
webrick
/ httpservlet / cgihandler (12) -
webrick
/ httputils (12) -
webrick
/ log (24) -
win32
/ registry (36) - win32ole (288)
-
yaml
/ dbm (108) - zlib (48)
クラス
-
ARGF
. class (10) - Array (153)
- BasicSocket (24)
-
Benchmark
:: Tms (24) - BigDecimal (24)
- CGI (36)
- CSV (36)
-
CSV
:: Table (12) - DBM (84)
- Data (6)
- Date (36)
- DateTime (12)
- Dir (12)
- Encoding (12)
-
Encoding
:: Converter (12) -
Encoding
:: InvalidByteSequenceError (36) - Enumerator (24)
- File (24)
-
File
:: Stat (12) - GDBM (72)
-
Gem
:: Command (12) -
Gem
:: Commands :: DependencyCommand (36) -
Gem
:: ConfigFile (12) -
Gem
:: Dependency (24) -
Gem
:: Indexer (24) -
Gem
:: Package :: TarHeader (12) -
Gem
:: Package :: TarInput (12) -
Gem
:: Package :: TarReader :: Entry (36) -
Gem
:: Platform (12) -
Gem
:: Requirement (12) -
Gem
:: Security :: Policy (12) -
Gem
:: SourceInfoCache (60) -
Gem
:: Specification (60) - IO (48)
-
IRB
:: Context (12) -
JSON
:: State (12) - Logger (12)
-
Logger
:: Formatter (12) - MatchData (12)
- Module (184)
-
Net
:: FTP (12) -
Net
:: FTP :: MLSxEntry (80) -
Net
:: HTTP (108) -
Net
:: HTTPGenericRequest (12) -
Net
:: HTTPResponse (48) -
Net
:: IMAP (12) -
Net
:: IMAP :: BodyTypeBasic (108) -
Net
:: IMAP :: BodyTypeMessage (108) -
Net
:: IMAP :: BodyTypeMultipart (60) -
Net
:: IMAP :: BodyTypeText (108) -
Net
:: IMAP :: ContentDisposition (12) -
Net
:: IMAP :: Envelope (12) -
Net
:: IMAP :: MailboxList (12) -
Net
:: SMTP (44) - Object (188)
-
OpenSSL
:: Cipher (12) -
OpenSSL
:: HMAC (24) -
OpenSSL
:: PKCS7 (24) -
OpenSSL
:: PKCS7 :: RecipientInfo (12) -
OpenSSL
:: PKey :: DH (84) -
OpenSSL
:: PKey :: DSA (120) -
OpenSSL
:: PKey :: EC (72) -
OpenSSL
:: PKey :: EC :: Group (60) -
OpenSSL
:: PKey :: PKey (12) -
OpenSSL
:: PKey :: RSA (156) -
OpenSSL
:: SSL :: SSLSocket (24) -
OpenSSL
:: X509 :: ExtensionFactory (36) -
OpenSSL
:: X509 :: Name (24) -
OpenSSL
:: X509 :: StoreContext (12) - OptionParser (12)
-
OptionParser
:: ParseError (24) - PStore (36)
- Pathname (12)
- PrettyPrint (12)
-
Psych
:: Nodes :: Alias (12) -
Psych
:: Nodes :: Document (12) -
Psych
:: Nodes :: Mapping (24) -
Psych
:: Nodes :: Node (36) -
Psych
:: Nodes :: Scalar (36) -
Psych
:: Nodes :: Sequence (24) -
Psych
:: ScalarScanner (24) -
Psych
:: SyntaxError (36) -
Psych
:: Visitors :: YAMLTree (12) -
REXML
:: AttlistDecl (12) -
REXML
:: Attribute (12) -
REXML
:: DocType (96) -
REXML
:: Element (36) -
REXML
:: Entity (120) -
REXML
:: ExternalEntity (12) -
REXML
:: NotationDecl (12) -
REXML
:: Text (24) -
Rake
:: EarlyTime (12) -
Rake
:: FileList (24) -
Rake
:: InvocationChain :: EmptyInvocationChain (12) - Random (19)
-
Resolv
:: DNS (36) - Ripper (12)
-
Ripper
:: Lexer (24) - RubyVM (24)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (140) - SDBM (84)
- Shell (12)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) -
Shell
:: SystemCommand (24) - Socket (48)
-
Socket
:: AncillaryData (12) -
Socket
:: Option (12) - String (287)
- StringIO (194)
- StringScanner (72)
- Struct (48)
- Symbol (395)
- SyntaxError (3)
-
Syslog
:: Logger (12) -
Syslog
:: Logger :: Formatter (12) - Thread (12)
- Time (30)
- UDPSocket (12)
-
URI
:: FTP (12) -
URI
:: Generic (24) - UnboundMethod (24)
-
WEBrick
:: HTTPRequest (72) -
WEBrick
:: HTTPResponse (24) -
WEBrick
:: HTTPServlet :: CGIHandler (12) -
WEBrick
:: Log (24) -
WIN32OLE
_ METHOD (24) -
WIN32OLE
_ PARAM (24) -
WIN32OLE
_ TYPE (132) -
WIN32OLE
_ TYPELIB (60) -
WIN32OLE
_ VARIABLE (24) -
WIN32OLE
_ VARIANT (24) -
Win32
:: Registry (36) -
YAML
:: DBM (108) -
Zlib
:: Deflate (24) -
Zlib
:: Inflate (24)
モジュール
- Benchmark (12)
-
CGI
:: HtmlExtension (48) -
CGI
:: QueryExtension (384) - Etc (240)
- Fiddle (12)
- Gem (60)
- JSON (24)
-
JSON
:: Generator :: GeneratorMethods :: Array (12) - Kernel (24)
-
Net
:: HTTPHeader (120) - Open3 (24)
- OpenSSL (12)
-
OpenSSL
:: PKCS5 (24) -
OpenSSL
:: Random (24) -
OpenURI
:: Meta (12) - Psych (91)
-
REXML
:: Namespace (12) - RbConfig (12)
-
RubyVM
:: AbstractSyntaxTree (10) - SecureRandom (12)
- Shellwords (24)
- Syslog (36)
-
WEBrick
:: AccessLog (12) -
WEBrick
:: HTTPUtils (12)
オブジェクト
- ENV (132)
-
Readline
:: HISTORY (108) - main (54)
キーワード
- * (36)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - << (12)
- <=> (12)
- =~ (12)
- ASN1 (12)
-
BUILD
_ RUBY _ PLATFORM (12) -
CLF
_ TIME _ FORMAT (12) -
DEFAULT
_ ENTITIES (12) -
DEFAULT
_ OBJECT _ TYPE (12) -
EMPTY
_ MARSHAL _ CHECKSUM (12) -
EMPTY
_ MARSHAL _ DATA (12) -
EMPTY
_ STRING (12) - Emitter (12)
- FORMAT (24)
-
INSTRUCTION
_ NAMES (12) -
LIBYAML
_ VERSION (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 1 . 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 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) -
OBJECT
_ TYPE _ TEMPLATE (12) -
OPENSSL
_ LIBRARY _ VERSION (12) - OPTS (12)
- Pretty (12)
-
RFC822
_ DAYS (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) - Ruby (12)
- RubyGemsPackageVersion (12)
- RubyGemsVersion (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Rubyの起動 (12)
- Ruby用語集 (12)
-
SC
_ ADVISORY _ INFO (12) -
SC
_ ASYNCHRONOUS _ IO (12) -
SC
_ AVPHYS _ PAGES (12) -
SC
_ DELAYTIMER _ MAX (12) -
SC
_ FSYNC (12) -
SC
_ MEMORY _ PROTECTION (12) -
SC
_ PHYS _ PAGES (12) -
SC
_ PRIORITY _ SCHEDULING (12) -
SC
_ SHARED _ MEMORY _ OBJECTS (12) -
SC
_ SYMLOOP _ MAX (12) -
SC
_ SYNCHRONIZED _ IO (12) -
SC
_ THREAD _ KEYS _ MAX (12) -
SC
_ THREAD _ PRIORITY _ SCHEDULING (12) -
SC
_ TRACE _ SYS _ MAX (12) -
SC
_ TTY _ NAME _ MAX (12) -
SC
_ TYPED _ MEMORY _ OBJECTS (12) -
SC
_ XOPEN _ CRYPT (12) -
SYSTEM
_ WIDE _ CONFIG _ FILE (12) - Symbol (12)
- VERSION (36)
- [] (192)
- []= (24)
- abbrev (12)
-
absolute
_ path (12) - accept (12)
-
accept
_ charset (12) -
accept
_ encoding (12) -
accept
_ language (12) -
alias
_ method (4) - anchor (48)
-
append
_ as _ bytes (1) - arguments (12)
- arity (12)
-
array
_ nl (12) -
ascii
_ only? (12) - attr (24)
-
attr
_ accessor (4) -
attr
_ reader (4) -
attr
_ writer (4) -
attribute
_ of (12) -
auth
_ type (12) -
base
_ label (12) - basename (12)
- bind (12)
- body (60)
-
builtin
_ curves (12) - byteindex (3)
- byterindex (3)
- bytes (57)
- bytesize (12)
- byteslice (36)
- bytesplice (10)
-
cache
_ control (12) - call (24)
- capability (12)
-
capable
_ auth _ types (12) - capitalize (12)
- casecmp (12)
- casecmp? (9)
- charset (10)
- clone (12)
- coerce (12)
- command (6)
-
compile
_ option (12) -
compute
_ key (12) -
content
_ id (36) -
content
_ type (60) - context (12)
-
create
_ body (12) -
create
_ ext _ from _ string (12) -
create
_ extension (24) - crypt (12)
-
curve
_ name (12) - data (12)
-
datetime
_ format (12) - decrypt (12)
-
default
_ system _ source _ cache _ dir (12) - define (6)
-
define
_ method (48) -
define
_ singleton _ method (24) - delete (60)
-
delete
_ at (12) - description (36)
-
dest
_ directory (12) -
destination
_ encoding _ name (12) -
dh
_ compute _ key (12) -
did
_ you _ mean (12) - digest (12)
- directory (12)
- disasm (24)
- disassemble (24)
- downcase (12)
-
dsa
_ sign _ asn1 (12) -
dsp
_ type (12) - dummy? (12)
-
dummy
_ makefile (12) - dump (24)
-
dump
_ stream (12) - dup (12)
- each (24)
-
each
_ byte (48) -
each
_ key (12) -
each
_ resource (12) - empty? (36)
-
enc
_ key (12) - encoding (48)
-
end
_ with? (6) - entities (12)
- entity (24)
- entries (12)
- eos? (12)
-
error
_ bytes (12) - export (60)
- external (12)
-
external
_ id (12) - facility (12)
- facts (10)
- fetch (84)
- file (12)
-
filter
_ backtrace (12) - flush (12)
- form (24)
- format (12)
- from (12)
- fsync (12)
- ftype (54)
-
full
_ name (12) -
gateway
_ interface (12) -
get
_ byte (12) -
get
_ fields (12) - getaddrinfo (12)
- getbyte (36)
- getc (12)
- getresource (12)
- getresources (12)
- gets (12)
- getservbyport (12)
- gsub (12)
- guid (24)
- helpfile (12)
- helpstring (12)
- hexdigest (12)
-
history
_ file (12) - host (12)
- id2name (12)
- ident (12)
-
in
_ reply _ to (12) - index (12)
- inspect (61)
- intern (24)
- invert (12)
- isatty (12)
- join (24)
- key (60)
- keys (60)
- label (12)
- lang (10)
- language (48)
-
latest
_ system _ cache _ file (24) - length (12)
- lex (24)
-
library
_ name (12) -
load
_ from _ binary _ extra _ data (10) - logger (12)
-
main
_ type (12) - match (12)
- match? (9)
- matches? (12)
- md5 (36)
-
media
_ subtype (48) -
media
_ type (58) -
mime
_ type (12) -
module
_ function (24) -
multipart
_ form (24) - name (83)
- names (12)
- namespace (12)
- namespaces (12)
- ndata (12)
- negotiate (12)
- new (78)
- newline (12)
- next (12)
- normalize (12)
-
normalize
_ yaml _ input (12) - normalized (12)
- notify (18)
-
ole
_ type (36) -
ole
_ type _ detail (24) - pack (21)
- pack テンプレート文字列 (12)
- param (48)
- params (48)
- parse (34)
-
parse
_ time (12) - path (27)
-
path
_ info (12) -
path
_ translated (12) -
pathmap
_ explode (12) - pathname (10)
-
pbkdf2
_ hmac (12) -
pbkdf2
_ hmac _ sha1 (12) - peek (12)
- peep (12)
- perm (10)
-
pipeline
_ r (24) - pop (12)
- pragma (12)
- prefix (12)
- prefixes (12)
- pretty (12)
-
pretty
_ generate (12) -
pretty
_ inspect (12) -
pretty
_ print (12) -
pretty
_ print _ inspect (12) -
pretty
_ print _ instance _ variables (12) -
pretty
_ unparse (12) -
print
_ dependencies (12) - private (51)
-
private
_ decrypt (12) -
private
_ encrypt (12) - problem (12)
- progid (12)
- progids (12)
- protected (36)
-
proxy
_ address (24) -
proxy
_ basic _ auth (12) -
proxy
_ pass (24) -
proxy
_ uri (12) -
proxy
_ user (24) - proxyaddr (12)
-
pseudo
_ bytes (12) -
psych
_ to _ yaml (12) - pubid (12)
- public (63)
-
public
_ decrypt (12) -
public
_ encrypt (12) - push (12)
- putback (12)
- query (24)
-
query
_ string (24) -
query
_ string= (12) -
random
_ bytes (24) -
random
_ key (12) -
rb
_ check _ convert _ type (12) - read (24)
-
read
_ body (24) -
read
_ nonblock (22) -
readagain
_ bytes (12) - readbyte (12)
- readline (12)
-
recvfrom
_ nonblock (12) - recvmsg (12)
-
recvmsg
_ nonblock (12) - ref (12)
- referer (12)
- registry (12)
- reject (12)
-
remote
_ addr (12) -
remote
_ host (12) -
remote
_ ident (12) -
remote
_ user (12) -
request
_ method (12) -
requirements
_ list (12) -
return
_ type (12) -
return
_ type _ detail (12) - rss (12)
- ruby (24)
-
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
/ commands / search _ command (12) -
rubygems
/ security (12) -
rubygems
_ version (12) -
safe
_ load (19) - scanf (36)
-
script
_ name (12) - scrub (12)
- scrub! (12)
- seed (12)
- select (48)
-
server
_ name (12) -
server
_ protocol (12) -
server
_ software (12) -
set
_ backtrace (12) -
set
_ dictionary (24) - setbyte (12)
- shelljoin (24)
- shift (36)
- sign (12)
-
signing
_ key (12) - size (12)
- slice (60)
- split (12)
-
src
_ type (12) -
ssl
_ version (12) - start (32)
-
start
_ with? (6) - store (48)
- strftime (24)
-
sub
_ type (12) - subtype (48)
- succ (12)
- summary (24)
-
summary
_ indent (12) - swapcase (12)
- sync (24)
- sync= (12)
- sysconfdir (12)
- sysread (60)
- syssign (12)
- system (36)
-
system
_ cache _ file (24) - systmpdir (12)
- syswrite (36)
- tag (48)
-
tag
_ directives (12) -
thread
_ variable? (12) -
time
_ format (12) -
time
_ format= (12) -
to
_ a (12) -
to
_ binary (10) -
to
_ csv (12) -
to
_ der (60) -
to
_ json (60) -
to
_ pem (84) -
to
_ ruby (12) -
to
_ s (180) -
to
_ sym (24) -
to
_ text (60) -
to
_ yaml (24) - tokenize (12)
-
trusted
_ cert _ path (12) -
try
_ convert (24) -
try
_ file (12) - tty? (12)
- type (10)
- typecode (12)
- typeflag (12)
- typelibs (12)
- uname (12)
- ungetbyte (12)
- unique (10)
- unnormalize (12)
- unnormalized (12)
- unpack (24)
-
unpack
_ sockaddr _ in (12) - upcase (12)
- usage (12)
-
user
_ agent (12) - value (24)
-
values
_ at (48) - vartype (12)
- verify (24)
-
with
_ object (24) -
write
_ nonblock (12) - yaml (24)
-
yield
_ self (16) -
zipped
_ stream (12) - クラス/メソッドの定義 (12)
- パターンマッチ (12)
- 正規表現 (12)
検索結果
先頭5件
-
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (27230.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".byterindex(......][ruby]{
'foo'.byterindex('f') # => 0
'foo'.byterindex('o') # => 2
'foo'.byterindex('oo') # => 1
'foo'.byterindex('ooo') # => nil
'foo'.byterindex(/f/) # => 0
'foo'.byterindex(/o/) # => 2
'foo'.byterindex(/oo/) # => 1
'foo'.byterindex(/ooo/) # => nil
# 右でのマッチが優先
'foo'.byterindex(... -
String
. try _ convert(obj) -> String | nil (27229.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
# byteslice(nth , len=1) -> String | nil (27218.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 (27218.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
# bytesplice(index , length , str) -> String (27216.0) -
self の一部または全部を str で置き換えて self を返します。
....byteslice(str_index, str_length) もしくは str.byteslice(str_range) で置き換えます。
ただし、str の部分文字列は新しい文字列オブジェクトとして生成されません。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byt......r_range str の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# bytesplice(index , length , str , str _ index , str _ length) -> String (27216.0) -
self の一部または全部を str で置き換えて self を返します。
....byteslice(str_index, str_length) もしくは str.byteslice(str_range) で置き換えます。
ただし、str の部分文字列は新しい文字列オブジェクトとして生成されません。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byt......r_range str の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# bytesplice(range , str) -> String (27216.0) -
self の一部または全部を str で置き換えて self を返します。
....byteslice(str_index, str_length) もしくは str.byteslice(str_range) で置き換えます。
ただし、str の部分文字列は新しい文字列オブジェクトとして生成されません。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byt......r_range str の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# bytesplice(range , str , str _ range) -> String (27216.0) -
self の一部または全部を str で置き換えて self を返します。
....byteslice(str_index, str_length) もしくは str.byteslice(str_range) で置き換えます。
ただし、str の部分文字列は新しい文字列オブジェクトとして生成されません。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byt......r_range str の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# bytesplice(index , length , str) -> String (27214.0) -
self の一部または全部を str で置き換えて self を返します。
...全部を str で置き換えて self を返します。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byteslice と同じです。
置き換え後の文字列の長さが対象の長さと違う場合、
適切に長さが調整されます。
@param......い文字列の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# bytesplice(range , str) -> String (27214.0) -
self の一部または全部を str で置き換えて self を返します。
...全部を str で置き換えて self を返します。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byteslice と同じです。
置き換え後の文字列の長さが対象の長さと違う場合、
適切に長さが調整されます。
@param......い文字列の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# byteslice(nth) -> String | nil (27213.0) -
nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。 引数が範囲外を指定した場合は nil を返します。
...rn 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1) # => "e"
"hello".byteslice(-1) # => "o"
"\u3042".byteslice(0) # => "\xE3"
"\u3042".byteslice(1) # => "\x81"
//}
@see String#slice... -
String
# bytes {|byte| . . . } -> self (27212.0) -
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
..._byte.to_a と同じです)
//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}
ブロックが指定された場合は String#each_byte と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#e......ach_byte... -
String
# byteslice(nth) -> String | nil (27211.0) -
nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。 引数が範囲外を指定した場合は nil を返します。
...rn 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//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 (27211.0) -
nth バイト目から長さ len バイトの部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は nil を返します。
...数で指定します。
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1, 2) # => "el"
"\u3042\u3044\u3046".byteslice(0, 3) # => "\u3042"
//}
@see String#slice... -
String
# byteslice(range) -> String | nil (27211.0) -
range で指定したバイトの範囲に含まれる部分文字列を返します。引数が範囲 外を指定した場合は nil を返します。
...を示す Range オブジェクト
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1..2) # => "el"
"\x03\u3042\xff".byteslice(1..3) # => "\u3042"
//}
@see String#slice... -
String
# crypt(salt) -> String (27207.0) -
self と salt から暗号化された文字列を生成して返します。 salt には英数字、ドット (「.」)、スラッシュ (「/」) から構成される、 2 バイト以上の文字列を指定します。
...どがあります。
注意:
* Ruby 2.6 から非推奨になったため、引き続き必要な場合は
string-crypt gem の使用を検討してください。
* crypt の処理は crypt(3) の実装に依存しています。
従って、crypt で処理される内容の詳細や......用環境の crypt(3) 等を見て確認してください。
* crypt の結果は利用環境が異なると変わる場合があります。
crypt の結果を、異なる利用環境間で使用する場合には注意して下さい。
* 典型的な DES を使用した crypt(3) の場......文字列
//emlist[例][ruby]{
# パスワードの暗号化
salt = [rand(64),rand(64)].pack("C*").tr("\x00-\x3f","A-Za-z0-9./")
passwd.crypt(salt)
# UNIX のログイン認証
require 'etc'
def valid_login?(user, password)
ent = Etc.getpwnam(user)
password.crypt(ent.passwd) == ent.passwd
end... -
String
# each _ byte {|byte| . . . } -> self (27206.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
# append _ as _ bytes(*objects) -> self (27112.0) -
引数で与えたオブジェクトをバイト列として、self に破壊的に連結します。
.../emlist[例][ruby]{
s = "あ".b # => "\xE3\x81\x82"
s.encoding # => #<Encoding:BINARY (ASCII-8BIT)>
s.append_as_bytes("い") # => "\xE3\x81\x82\xE3\x81\x84"
# s << "い" では連結できない
s << "い" # => "incompatible character encodings: BINARY (ASCII-8BIT) a......nd UTF-8 (Encoding::CompatibilityError)
//}
//emlist[引数で整数を渡す例][ruby]{
t = ""
t.append_as_bytes(0x61) # => "a"
t.append_as_bytes(0x3062) # => "ab"
//}
@see String#<<, String#concat... -
String
# byteindex(pattern , offset = 0) -> Integer | nil (27112.0) -
文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...st[例][ruby]{
'foo'.byteindex('f') # => 0
'foo'.byteindex('o') # => 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......'foo'.byteindex('o', 3) # => nil
'foo'.byteindex('o', -1) # => 2
'foo'.byteindex('o', -2) # => 1
'foo'.byteindex('o', -3) # => 1
'foo'.byteindex('o', -4) # => nil
'あいう'.byteindex('う') # => 6
'あいう'.byteindex('う', 3) # => 6
'あいう'.byteindex('う', -3) # => 6
'あいう'.byteinde......x('う', 1) # offset 1 does not land on character boundary (IndexError)
//}
@see String#index, String#byterindex...