るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice
  3. string []
  4. string slice!
  5. string gsub

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

String#count(*chars) -> Integer (27132.0)

chars で指定された文字が文字列 self にいくつあるか数えます。

...文字のパターン

//emlist[例][ruby]{
p 'abcdefg'.count('c') # => 1
p '123456789'.count('2378') # => 4
p '123456789'.count('2-8', '^4-6') # => 4

# ファイルの行数を数える
n_lines = File.read("foo").count("\n")

# ファイルの末尾に改行コードがな...
...い場合にも対処する
buf = File.read("foo")
n_lines = buf.count("\n")
n_lines += 1 if /[^\n]\z/ =~ buf
# if /\n\z/ !~ buf だと空ファイルを 1 行として数えてしまうのでダメ
//}...

Scanf::FormatString#matched_count (9102.0)

@todo

@todo

Scanf::FormatString#spec_count (9102.0)

@todo

@todo

Scanf::FormatString#prune(n=matched_count) (3102.0)

@todo

@todo

Net::HTTPHeader#basic_auth(account, password) -> [String] (202.0)

Authorization: ヘッダを BASIC 認証用にセットします。

...Authorization: ヘッダを BASIC 認証用にセットします。

@param account アカウント名を文字列で与えます。
@param password パスワードを文字列で与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net:...

絞り込み条件を変える

Net::HTTPHeader#proxy_basic_auth(account, password) -> [String] (202.0)

Proxy 認証のために Proxy-Authorization: ヘッダをセットします。

...@param account アカウント名を文字列で与えます。
@param password パスワードを文字列で与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.proxy_basic_auth("account", "pass...

UnboundMethod#inspect -> String (127.0)

self を読みやすい文字列として返します。

...self を読みやすい文字列として返します。

詳しくは Method#inspect を参照してください。

//emlist[例][ruby]{
String
.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}

@see Method#inspect...

UnboundMethod#to_s -> String (127.0)

self を読みやすい文字列として返します。

...self を読みやすい文字列として返します。

詳しくは Method#inspect を参照してください。

//emlist[例][ruby]{
String
.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}

@see Method#inspect...

CSV::Table#inspect -> String (108.0)

モードとサイズを US-ASCII な文字列で返します。

...モードとサイズを US-ASCII な文字列で返します。

//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.inspect # => "#<CSV::Table mode:col_or_row row_count:2>"
//}...

UnboundMethod#arity -> Integer (31.0)

メソッドが受け付ける引数の数を返します。

...).arity #=> 2
p C.instance_method(:five).arity #=> -3
p C.instance_method(:six).arity #=> -3


String
.instance_method(:size).arity #=> 0
String
.instance_method(:replace).arity #=> 1
String
.instance_method(:squeeze).arity #=> -1
String
.instance_method(:count).arity #=> -1
//}...

絞り込み条件を変える

<< 1 2 > >>