るりまサーチ

最速Rubyリファレンスマニュアル検索!
28056件ヒット [201-300件を表示] (0.141秒)

別のキーワード

  1. matrix tr
  2. string tr
  3. string tr!
  4. _builtin tr
  5. string tr_s

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

StringScanner#string -> String (9201.0)

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

...uby]{
require '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" が返る可能性あり)
//}...

StringScanner#string=(str) (9201.0)

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

...str に変更して、マッチ記録を捨てます。

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

@return str を返します。

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

str = '0123'
s = StringScanner.new('test string')
s.string = str...

TracePoint#instruction_sequence -> RubyVM::InstructionSequence (9201.0)

script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。

..._compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。

//emlist[例][ruby]{
Tr
acePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("puts...

String#tr_s!(pattern, replace) -> self | nil (9180.0)

文字列の中に pattern 文字列に含まれる文字が存在したら、 replace 文字列の対応する文字に置き換えます。さらに、 置換した部分内に同一の文字の並びがあったらそれを 1 文字に圧縮します。

... tr(1) と同じです。
つまり「a-c」は a から c を意味し、
"^0-9" のように文字列の先頭が「^」の場合は指定した文字以外が置換の対象になります。

replace でも「-」を使って範囲を指定できます。

//emlist[][ruby]{
p "gooooogle".tr_s...
...われます。

tr
_s は置換後の文字列を生成して返します。
tr
_s! は self を変更して返しますが、
置換が起こらなかった場合は nil を返します。

注意:
一般に、tr_s! を tr! と squeeze! で置き換えることはできません。
tr
! と squeeze!...
...せでは tr! の置換後の文字列全体を squeeze! しますが、
tr
_s! は置換された部分だけを squeeze! します。
以下のコードを参照してください。

//emlist[例][ruby]{
str = "foo"
str.tr_s!("o", "f")
p str # => "ff"

str = "foo"
str.tr!("o", "f")
str.squeeze!(...

String#tr!(pattern, replace) -> self | nil (9126.0)

pattern 文字列に含まれる文字を検索し、 それを replace 文字列の対応する文字に破壊的に置き換えます。

...字列に含まれる文字を検索し、
それを replace 文字列の対応する文字に破壊的に置き換えます。

pattern の形式は tr(1) と同じです。
つまり、`a-c' は a から c を意味し、
"^0-9" のように文字列の先頭が `^' の場合は
指定文字以外...
...くものと扱われます。

tr
! は self を変更して返しますが、
置換が起こらなかった場合は nil を返します。

@param pattern 置き換える文字のパターン
@param replace pattern で指定した文字を置き換える文字

@see String#tr, String#tr_s...

絞り込み条件を変える

Matrix#trace -> Integer | Float | Rational | Complex (9102.0)

トレース (trace) を返します。

...トレース (trace) を返します。

行列のトレース (trace) とは、対角要素の和です。

//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6], [3,9]].trace # => 16
//}

tr
ace は正方行列でのみ定義されます。

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が...

Fiddle::CStruct#to_ptr -> Fiddle::Pointer (9101.0)

保持している構造体へのポインタを返します。

保持している構造体へのポインタを返します。

Matrix#antisymmetric? -> bool (9101.0)

行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。

... true を返します。

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します

//emlist[][ruby]{
require 'matrix'

Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix.empty.antisymmetric? # => true...
...Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetric? # => false
# 符号が違う
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}...

Matrix#lower_triangular? -> bool (9101.0)

行列が下三角行列ならば true を返します。

...行列が下三角行列ならば true を返します。...

Matrix#skew_symmetric? -> bool (9101.0)

行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。

... true を返します。

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します

//emlist[][ruby]{
require 'matrix'

Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix.empty.antisymmetric? # => true...
...Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetric? # => false
# 符号が違う
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}...

絞り込み条件を変える

<< < 1 2 3 4 5 ... > >>