種類
ライブラリ
- ビルトイン (1535)
- abbrev (11)
- benchmark (33)
- bigdecimal (22)
-
cgi
/ core (363) -
cgi
/ html (44) -
cgi
/ util (22) - csv (55)
- date (22)
- dbm (77)
- etc (220)
- fiddle (11)
- gdbm (66)
-
irb
/ ext / save-history (11) - json (44)
-
json
/ add / date (11) -
json
/ add / date _ time (11) -
json
/ add / symbol (11) - logger (22)
- mkmf (11)
-
net
/ ftp (83) -
net
/ http (264) -
net
/ imap (396) -
net
/ smtp (39) - open-uri (11)
- open3 (22)
- openssl (682)
- optparse (33)
- pathname (11)
- pp (33)
- prettyprint (11)
- pstore (33)
- psych (336)
- rake (55)
- rbconfig (11)
- readline (99)
- resolv (33)
-
rexml
/ document (319) -
ripper
/ lexer (33) - rubygems (33)
-
rubygems
/ command (11) -
rubygems
/ commands / dependency _ command (33) -
rubygems
/ config _ file (11) -
rubygems
/ defaults (22) -
rubygems
/ dependency (22) -
rubygems
/ indexer (22) -
rubygems
/ package / tar _ header (11) -
rubygems
/ package / tar _ input (11) -
rubygems
/ package / tar _ reader / entry (33) -
rubygems
/ platform (11) -
rubygems
/ requirement (11) -
rubygems
/ security (11) -
rubygems
/ source _ info _ cache (55) -
rubygems
/ specification (55) - scanf (36)
- sdbm (77)
- securerandom (11)
- shell (12)
-
shell
/ command-processor (6) -
shell
/ filter (6) -
shell
/ system-command (24) - shellwords (33)
- socket (99)
- stringio (179)
- strscan (66)
- syslog (33)
-
syslog
/ logger (22) - uri (33)
-
webrick
/ accesslog (11) -
webrick
/ httprequest (66) -
webrick
/ httpresponse (22) -
webrick
/ httpservlet / cgihandler (11) -
webrick
/ httputils (11) -
webrick
/ log (22) -
win32
/ registry (33) - win32ole (264)
-
yaml
/ dbm (99) - zlib (44)
クラス
-
ARGF
. class (9) - Array (140)
- BasicSocket (22)
-
Benchmark
:: Tms (22) - BigDecimal (22)
- CGI (33)
- CSV (33)
-
CSV
:: Table (11) - DBM (77)
- Data (4)
- Date (33)
- DateTime (11)
- Dir (11)
- Encoding (11)
-
Encoding
:: Converter (11) -
Encoding
:: InvalidByteSequenceError (33) - Enumerator (22)
- File (22)
-
File
:: Stat (11) - GDBM (66)
-
Gem
:: Command (11) -
Gem
:: Commands :: DependencyCommand (33) -
Gem
:: ConfigFile (11) -
Gem
:: Dependency (22) -
Gem
:: Indexer (22) -
Gem
:: Package :: TarHeader (11) -
Gem
:: Package :: TarInput (11) -
Gem
:: Package :: TarReader :: Entry (33) -
Gem
:: Platform (11) -
Gem
:: Requirement (11) -
Gem
:: Security :: Policy (11) -
Gem
:: SourceInfoCache (55) -
Gem
:: Specification (55) - IO (45)
-
IRB
:: Context (11) -
JSON
:: State (11) - Logger (11)
-
Logger
:: Formatter (11) - MatchData (11)
- Module (87)
-
Net
:: FTP (11) -
Net
:: FTP :: MLSxEntry (72) -
Net
:: HTTP (99) -
Net
:: HTTPGenericRequest (11) -
Net
:: HTTPResponse (44) -
Net
:: IMAP (11) -
Net
:: IMAP :: BodyTypeBasic (99) -
Net
:: IMAP :: BodyTypeMessage (99) -
Net
:: IMAP :: BodyTypeMultipart (55) -
Net
:: IMAP :: BodyTypeText (99) -
Net
:: IMAP :: ContentDisposition (11) -
Net
:: IMAP :: Envelope (11) -
Net
:: IMAP :: MailboxList (11) -
Net
:: SMTP (39) - Object (171)
-
OpenSSL
:: Cipher (11) -
OpenSSL
:: HMAC (22) -
OpenSSL
:: PKCS7 (22) -
OpenSSL
:: PKCS7 :: RecipientInfo (11) -
OpenSSL
:: PKey :: DH (77) -
OpenSSL
:: PKey :: DSA (110) -
OpenSSL
:: PKey :: EC (66) -
OpenSSL
:: PKey :: EC :: Group (55) -
OpenSSL
:: PKey :: PKey (11) -
OpenSSL
:: PKey :: RSA (143) -
OpenSSL
:: SSL :: SSLSocket (22) -
OpenSSL
:: X509 :: ExtensionFactory (33) -
OpenSSL
:: X509 :: Name (22) -
OpenSSL
:: X509 :: StoreContext (11) - OptionParser (11)
-
OptionParser
:: ParseError (22) - PStore (33)
- Pathname (11)
- PrettyPrint (11)
-
Psych
:: Nodes :: Alias (11) -
Psych
:: Nodes :: Document (11) -
Psych
:: Nodes :: Mapping (22) -
Psych
:: Nodes :: Node (33) -
Psych
:: Nodes :: Scalar (33) -
Psych
:: Nodes :: Sequence (22) -
Psych
:: ScalarScanner (22) -
Psych
:: SyntaxError (33) -
Psych
:: Visitors :: YAMLTree (11) -
REXML
:: AttlistDecl (11) -
REXML
:: Attribute (11) -
REXML
:: DocType (88) -
REXML
:: Element (33) -
REXML
:: Entity (110) -
REXML
:: ExternalEntity (11) -
REXML
:: NotationDecl (11) -
REXML
:: Text (22) -
Rake
:: EarlyTime (11) -
Rake
:: FileList (22) -
Rake
:: InvocationChain :: EmptyInvocationChain (11) - Random (17)
-
Resolv
:: DNS (33) - Ripper (11)
-
Ripper
:: Lexer (22) - RubyVM (22)
-
RubyVM
:: AbstractSyntaxTree :: Node (6) -
RubyVM
:: InstructionSequence (128) - SDBM (77)
- Shell (12)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) -
Shell
:: SystemCommand (24) - Socket (44)
-
Socket
:: AncillaryData (11) -
Socket
:: Option (11) - String (256)
- StringIO (179)
- StringScanner (66)
- Struct (44)
- Symbol (360)
- SyntaxError (2)
-
Syslog
:: Logger (11) -
Syslog
:: Logger :: Formatter (11) - Thread (11)
- Time (27)
- UDPSocket (11)
-
URI
:: FTP (11) -
URI
:: Generic (22) - UnboundMethod (22)
-
WEBrick
:: HTTPRequest (66) -
WEBrick
:: HTTPResponse (22) -
WEBrick
:: HTTPServlet :: CGIHandler (11) -
WEBrick
:: Log (22) -
WIN32OLE
_ METHOD (22) -
WIN32OLE
_ PARAM (22) -
WIN32OLE
_ TYPE (121) -
WIN32OLE
_ TYPELIB (55) -
WIN32OLE
_ VARIABLE (22) -
WIN32OLE
_ VARIANT (22) -
Win32
:: Registry (33) -
YAML
:: DBM (99) -
Zlib
:: Deflate (22) -
Zlib
:: Inflate (22)
モジュール
- Benchmark (11)
-
CGI
:: HtmlExtension (44) -
CGI
:: QueryExtension (352) - Etc (220)
- Fiddle (11)
- Gem (55)
- JSON (22)
-
JSON
:: Generator :: GeneratorMethods :: Array (11) - Kernel (45)
-
Net
:: HTTPHeader (110) - Open3 (22)
- OpenSSL (11)
-
OpenSSL
:: PKCS5 (22) -
OpenSSL
:: Random (22) -
OpenURI
:: Meta (11) - Psych (83)
-
REXML
:: Namespace (11) - RbConfig (11)
-
RubyVM
:: AbstractSyntaxTree (8) - SecureRandom (11)
- Shellwords (22)
- Syslog (33)
-
WEBrick
:: AccessLog (11) -
WEBrick
:: HTTPUtils (11)
オブジェクト
- ENV (121)
-
Readline
:: HISTORY (99) - main (46)
キーワード
- * (33)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (11)
- <=> (11)
- =~ (11)
- ASN1 (11)
-
BUILD
_ RUBY _ PLATFORM (11) -
CLF
_ TIME _ FORMAT (11) -
DEFAULT
_ ENTITIES (11) -
DEFAULT
_ OBJECT _ TYPE (11) -
EMPTY
_ MARSHAL _ CHECKSUM (11) -
EMPTY
_ MARSHAL _ DATA (11) -
EMPTY
_ STRING (11) - Emitter (11)
- FORMAT (22)
-
INSTRUCTION
_ NAMES (11) -
LIBYAML
_ VERSION (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) -
OBJECT
_ TYPE _ TEMPLATE (11) -
OPENSSL
_ LIBRARY _ VERSION (11) - OPTS (11)
- Pretty (11)
-
RFC822
_ DAYS (11) - RUBY (11)
-
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)
-
SC
_ ADVISORY _ INFO (11) -
SC
_ ASYNCHRONOUS _ IO (11) -
SC
_ AVPHYS _ PAGES (11) -
SC
_ DELAYTIMER _ MAX (11) -
SC
_ FSYNC (11) -
SC
_ MEMORY _ PROTECTION (11) -
SC
_ PHYS _ PAGES (11) -
SC
_ PRIORITY _ SCHEDULING (11) -
SC
_ SHARED _ MEMORY _ OBJECTS (11) -
SC
_ SYMLOOP _ MAX (11) -
SC
_ SYNCHRONIZED _ IO (11) -
SC
_ THREAD _ KEYS _ MAX (11) -
SC
_ THREAD _ PRIORITY _ SCHEDULING (11) -
SC
_ TRACE _ SYS _ MAX (11) -
SC
_ TTY _ NAME _ MAX (11) -
SC
_ TYPED _ MEMORY _ OBJECTS (11) -
SC
_ XOPEN _ CRYPT (11) -
SYSTEM
_ WIDE _ CONFIG _ FILE (11) - Symbol (11)
- VERSION (33)
- [] (176)
- []= (22)
- abbrev (11)
-
absolute
_ path (11) - accept (11)
-
accept
_ charset (11) -
accept
_ encoding (11) -
accept
_ language (11) -
alias
_ method (3) - anchor (44)
- arguments (11)
- arity (11)
-
array
_ nl (11) -
ascii
_ only? (11) - attr (20)
-
attr
_ accessor (3) -
attr
_ reader (3) -
attr
_ writer (3) -
attribute
_ of (11) -
auth
_ type (11) -
base
_ label (11) - basename (11)
- bind (11)
- body (55)
-
builtin
_ curves (11) - byteindex (2)
- byterindex (2)
- bytes (53)
- bytesize (11)
- byteslice (33)
- bytesplice (4)
-
cache
_ control (11) - call (22)
- capability (11)
-
capable
_ auth _ types (11) - capitalize (11)
- casecmp (11)
- casecmp? (8)
- charset (9)
- clone (11)
- coerce (11)
- command (6)
-
compile
_ option (11) -
compute
_ key (11) -
content
_ id (33) -
content
_ type (55) - context (11)
-
create
_ body (11) -
create
_ ext _ from _ string (11) -
create
_ extension (22) - crypt (11)
-
curve
_ name (11) - data (11)
-
datetime
_ format (11) - decrypt (11)
-
default
_ system _ source _ cache _ dir (11) - define (4)
-
define
_ method (44) -
define
_ singleton _ method (22) - delete (55)
-
delete
_ at (11) - description (33)
-
dest
_ directory (11) -
destination
_ encoding _ name (11) -
dh
_ compute _ key (11) -
did
_ you _ mean (11) - digest (11)
- directory (11)
- disasm (22)
- disassemble (22)
- downcase (11)
-
dsa
_ sign _ asn1 (11) -
dsp
_ type (11) - dummy? (11)
-
dummy
_ makefile (11) - dump (22)
-
dump
_ stream (11) - dup (11)
- each (22)
-
each
_ byte (44) -
each
_ key (11) -
each
_ resource (11) - empty? (33)
-
enc
_ key (11) - encoding (44)
-
end
_ with? (5) - entities (11)
- entity (22)
- entries (11)
- eos? (11)
-
error
_ bytes (11) - export (55)
- external (11)
-
external
_ id (11) - facility (11)
- facts (9)
- fetch (77)
- file (11)
-
filter
_ backtrace (11) - flush (11)
- form (22)
- format (11)
- from (11)
- fsync (11)
- ftype (51)
-
full
_ name (11) -
gateway
_ interface (11) -
get
_ byte (11) -
get
_ fields (11) - getaddrinfo (11)
- getbyte (33)
- getc (11)
- getresource (11)
- getresources (11)
- gets (11)
- getservbyport (11)
- gsub (11)
- guid (22)
- helpfile (11)
- helpstring (11)
- hexdigest (11)
-
history
_ file (11) - host (11)
- id2name (11)
- ident (11)
-
in
_ reply _ to (11) - index (11)
- inspect (55)
- intern (22)
- invert (11)
- isatty (11)
- join (22)
- key (55)
- keys (55)
- label (11)
- lang (9)
- language (44)
-
latest
_ system _ cache _ file (22) - length (11)
- lex (22)
-
library
_ name (11) -
load
_ from _ binary _ extra _ data (9) - logger (11)
-
main
_ type (11) - match (11)
- match? (8)
- matches? (11)
- md5 (33)
-
media
_ subtype (44) -
media
_ type (53) -
mime
_ type (11) -
module
_ function (8) -
multipart
_ form (22) - name (76)
- names (11)
- namespace (11)
- namespaces (11)
- ndata (11)
- negotiate (11)
- new (71)
- newline (11)
- next (11)
- normalize (11)
-
normalize
_ yaml _ input (11) - normalized (11)
- notify (18)
-
ole
_ type (33) -
ole
_ type _ detail (22) - pack (19)
- pack テンプレート文字列 (11)
- param (44)
- params (44)
- parse (30)
-
parse
_ time (11) - path (24)
-
path
_ info (11) -
path
_ translated (11) -
pathmap
_ explode (11) - pathname (9)
-
pbkdf2
_ hmac (11) -
pbkdf2
_ hmac _ sha1 (11) - peek (11)
- peep (11)
- perm (9)
-
pipeline
_ r (22) - pop (11)
- pragma (11)
- prefix (11)
- prefixes (11)
- pretty (11)
-
pretty
_ generate (11) -
pretty
_ inspect (11) -
pretty
_ print (11) -
pretty
_ print _ inspect (11) -
pretty
_ print _ instance _ variables (11) -
pretty
_ unparse (11) -
print
_ dependencies (11) - private (24)
-
private
_ decrypt (11) -
private
_ encrypt (11) - problem (11)
- progid (11)
- progids (11)
- protected (12)
-
proxy
_ address (22) -
proxy
_ basic _ auth (11) -
proxy
_ pass (22) -
proxy
_ uri (11) -
proxy
_ user (22) - proxyaddr (11)
-
pseudo
_ bytes (11) -
psych
_ to _ yaml (11) -
psych
_ y (11) - pubid (11)
- public (35)
-
public
_ decrypt (11) -
public
_ encrypt (11) - push (11)
- putback (11)
- query (22)
-
query
_ string (22) -
query
_ string= (11) -
random
_ bytes (22) -
random
_ key (11) -
rb
_ check _ convert _ type (11) - read (22)
-
read
_ body (22) -
read
_ nonblock (20) -
readagain
_ bytes (11) - readbyte (11)
- readline (11)
-
recvfrom
_ nonblock (11) - recvmsg (11)
-
recvmsg
_ nonblock (11) - ref (11)
- referer (11)
- registry (11)
- reject (11)
-
remote
_ addr (11) -
remote
_ host (11) -
remote
_ ident (11) -
remote
_ user (11) -
request
_ method (11) -
requirements
_ list (11) -
return
_ type (11) -
return
_ type _ detail (11) - rss (11)
- ruby (22)
-
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) - scanf (36)
-
script
_ name (11) - scrub (11)
- scrub! (11)
- seed (11)
- select (44)
-
server
_ name (11) -
server
_ protocol (11) -
server
_ software (11) -
set
_ backtrace (11) -
set
_ dictionary (22) - setbyte (11)
- shelljoin (22)
- shift (33)
- sign (11)
-
signing
_ key (11) - size (11)
- slice (55)
- split (11)
-
src
_ type (11) -
ssl
_ version (11) - start (28)
-
start
_ with? (5) - store (44)
- strftime (22)
-
sub
_ type (11) - subtype (44)
- succ (11)
- summary (22)
-
summary
_ indent (11) - swapcase (11)
- sync (22)
- sync= (11)
- sysconfdir (11)
- sysread (55)
- syssign (11)
- system (33)
-
system
_ cache _ file (22) - systmpdir (11)
- syswrite (33)
- tag (44)
-
tag
_ directives (11) -
thread
_ variable? (11) -
time
_ format (11) -
time
_ format= (11) -
to
_ a (11) -
to
_ binary (9) -
to
_ csv (11) -
to
_ der (55) -
to
_ json (55) -
to
_ pem (77) -
to
_ ruby (11) -
to
_ s (165) -
to
_ sym (22) -
to
_ text (55) -
to
_ yaml (22) - tokenize (11)
-
trusted
_ cert _ path (11) -
try
_ convert (22) -
try
_ file (11) - tty? (11)
- type (9)
- typecode (11)
- typeflag (11)
- typelibs (11)
- uname (11)
- ungetbyte (11)
- unique (9)
- unnormalize (11)
- unnormalized (11)
- unpack (22)
-
unpack
_ sockaddr _ in (11) - upcase (11)
- usage (11)
-
user
_ agent (11) - value (22)
-
values
_ at (44) - vartype (11)
- verify (22)
-
with
_ object (22) -
write
_ nonblock (11) - yaml (22)
-
yield
_ self (14) -
zipped
_ stream (11) - クラス/メソッドの定義 (11)
- 正規表現 (11)
検索結果
先頭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 (27214.0) -
self の一部または全部を str で置き換えて str を返します。
...は全部を str で置き換えて str を返します。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byteslice と同じです。
置き換え後の文字列の長さが対象の長さと違う場合、
適切に長さが調整されます。
@para......い文字列の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
String
# bytesplice(range , str) -> String (27214.0) -
self の一部または全部を str で置き換えて str を返します。
...は全部を str で置き換えて str を返します。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byteslice と同じです。
置き換え後の文字列の長さが対象の長さと違う場合、
適切に長さが調整されます。
@para......い文字列の範囲を示す 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
# 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... -
String
# bytes -> [Integer] (27112.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
# bytesize -> Integer (27106.0) -
文字列のバイト長を整数で返します。
...文字列のバイト長を整数で返します。
//emlist[例][ruby]{
#coding:UTF-8
# 実行結果は文字コードによって異なります。
p "いろは".size #=> 3
p "いろは".bytesize #=> 9
//}
@see String#size...