るりまサーチ

最速Rubyリファレンスマニュアル検索!
1125件ヒット [1-100件を表示] (0.037秒)

別のキーワード

  1. kernel test
  2. _builtin test
  3. rubygems/test_utilities tempio
  4. rubygems/test_utilities fetcher=
  5. testtask test_files=

キーワード

検索結果

<< 1 2 3 ... > >>

StringScanner#string -> String (21311.0)

スキャン対象にしている文字列を返します。

...quire 'strscan'

s = StringScanner.new('test string')
s.string # => "test string"
//}

返り値は freeze されていません。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
s.string.frozen? # => false
//}

なお、このメソッドは StringScanner.new に渡...
...依存したコードを書かないようにしましょう。

//emlist[例][ruby]{
require 'strscan'

str = 'test string'
s = StringScanner.new(str)
s.string == str # => true
s.string.eql?(str) # => true (将来は false になる可能性がある)
//}

また、返り値の文字列に対し...
...ないでください。

//emlist[例][ruby]{
require 'strscan'

str = 'test string'
s = StringScanner.new(str)
s.string.replace("0123")
s.scan(/\w+/) # => "0123" (将来は "test" が返る可能性あり)
str # => "0123" (将来は "test string" が返る可能性あり)
//}...

String#chr -> String (9138.0)

self の最初の文字だけを含む文字列を返します。

...値が Integer から String を返すように変更になりました。
Ruby 1.8 以前と1.9以降の互換性を保つために String#chr が存在します。

例:
# ruby 1.8 系では STDIN.getc が 116 を返すため Integer#chr が呼び出される
$ echo test | ruby -e "p STDIN.ge...
...tc.chr" # => "t"
# ruby 1.9 系以降では STDIN.getc が "t" を返すため String#chr が呼び出される
$ echo test | ruby -e "p STDIN.getc.chr" # => "t"

@see String#ord, Integer#chr...

StringScanner#string=(str) (9120.0)

スキャン対象の文字列を str に変更して、マッチ記録を捨てます。

...す。

@param str スキャン対象の文字列を str に変更して、マッチ記録を捨てます。

@return str を返します。

//emlist[例][ruby]{
require 'strscan'

str = '0123'
s = StringScanner.new('test string')
s.string = str # => "0123"
s.scan(/\w+/) # => "0123"
//}...

String#length -> Integer (9019.0)

文字列の文字数を返します。バイト数を知りたいときは bytesize メソッドを使ってください。

...いときは bytesize メソッドを使ってください。

//emlist[例][ruby]{
"test".length # => 4
"test".size # => 4
"テスト".length # => 3
"テスト".size # => 3
"\x80\u3042".length # => 2
"\x80\u3042".size # => 2
//}

@see String#bytesize...

String#size -> Integer (9019.0)

文字列の文字数を返します。バイト数を知りたいときは bytesize メソッドを使ってください。

...いときは bytesize メソッドを使ってください。

//emlist[例][ruby]{
"test".length # => 4
"test".size # => 4
"テスト".length # => 3
"テスト".size # => 3
"\x80\u3042".length # => 2
"\x80\u3042".size # => 2
//}

@see String#bytesize...

絞り込み条件を変える

String#hash -> Integer (9013.0)

self のハッシュ値を返します。 eql? で等しい文字列は、常にハッシュ値も等しくなります。

...self のハッシュ値を返します。
eql? で等しい文字列は、常にハッシュ値も等しくなります。

//emlist[例][ruby]{
"test".hash # => 4038258770210371295
("te" + "st").hash == "test".hash # => true
//}

@see Hash...

String#encoding -> Encoding (9007.0)

文字列のエンコーディング情報を表現した Encoding オブジェクトを返します。

...列のエンコーディング情報を表現した Encoding オブジェクトを返します。

//emlist[例][ruby]{
# encoding: utf-8
utf8_str = "test"
euc_str = utf8_str.encode("EUC-JP")
utf8_str.encoding # => #<Encoding:UTF-8>
euc_str.encoding # => #<Encoding:EUC-JP>
//}

@see Encoding...

Gem::Specification#test_file -> String (6219.0)

Gem::Specification#test_files の単数バージョンです。

...Gem::Specification#test_files の単数バージョンです。...

Gem::Specification#test_suite_file -> String (6219.0)

この属性は非推奨です。 Gem::Specification#test_files を使用してください。

...この属性は非推奨です。 Gem::Specification#test_files を使用してください。...
<< 1 2 3 ... > >>