String

String

ri

 ---------------------------------------------------------- Class: String
      A  String  object holds and manipulates an arbitrary sequence of
      bytes, typically representing characters. String objects may be
      created using  String::new  or as literals.
 
      Because of aliasing issues, users of strings should be aware of the
      methods that modify the contents of a  String  object. Typically,
      methods with names ending in ``!'' modify their receiver, while
      those without a ``!'' return a new  String . However, there are
      exceptions, such as  String#[]= .
 
 ------------------------------------------------------------------------
 
 
 Includes:
 ---------
      Comparable(<, <=, ==, >, >=, between?), Enumerable(all?, any?,
      collect, detect, each_cons, each_slice, each_with_index, entries,
      enum_cons, enum_slice, enum_with_index, find, find_all, grep,
      include?, inject, map, max, member?, min, partition, reject,
      select, sort, sort_by, to_a, to_set, zip)
 
 
 Class methods:
 --------------
      new
 
 
 Instance methods:
 -----------------
      %, *,  , <<, <=>, ==, =~, , =, capitalize, capitalize!,
      casecmp, center, chomp, chomp!, chop, chop!, concat, count, crypt,
      delete, delete!, downcase, downcase!, dump, each, each_byte,
      each_line, empty?, eql?, gsub, gsub!, hash, hex, include?, index,
      initialize_copy, insert, inspect, intern, length, ljust, lstrip,
      lstrip!, match, next, next!, oct, replace, reverse, reverse!,
      rindex, rjust, rstrip, rstrip!, scan, size, slice, slice!, split,
      squeeze, squeeze!, strip, strip!, sub, sub!, succ, succ!, sum,
      swapcase, swapcase!, to_f, to_i, to_s, to_str, to_sym, tr, tr!,
      tr_s, tr_s!, unpack, upcase, upcase!, upto

refe

 ==== String ====
 文字列クラス。任意の長さのバイト列を扱うことができます。
 
 このクラスのメソッドのうち名前が ! で終るものは文字列の中身を
 直接変更します。このような場合は ! のついていない同じ名前の
 メソッドを使うほうが概して安全です。たとえば以下のような場合に問題に
 なることがあります。
 
     def foo(arg)
        arg.sub!(/good/, 'bad')
        arg
     end
 
     s = 'verygoodname'
     p foo(s)  # => 'verybadname'
     p s       # => 'verybadname'
 
 また日本語文字列を正しく処理するためには組み込み変数 $KCODE文字コードにあわせて設定しておく必要があります。
 
 
 String クラスは自身をバイト列として扱います。例えば str[1] は str の内
 容がなんであれ 2 バイト目の文字コードを返します。日本語文字列に対して
 (バイト単位でなく)文字単位の処理を行わせたい場合は jcode.rb を使
 用します。
 ---- Singleton methods ----
 new
 ---- Instance methods ----
 % *   < << <= <=> == =~ > >=  = capitalize capitalize!
 casecmp center chomp chomp! chop chop! clone concat count
 crypt delete delete! downcase downcase! dump dup each
 each_byte each_line empty? external_filter gsub gsub! hex
 include? index insert intern length ljust lstrip lstrip!
 match next next! oct replace reverse reverse! rindex rjust
 rstrip rstrip! scan size slice slice! split squeeze
 squeeze! strip strip! sub sub! succ succ! sum swapcase
 swapcase! to_f to_i to_s to_str to_sym tr tr! tr_s tr_s!
 unpack upcase upcase! upto ~
 ---- Singleton methods (inherited) ----
 ---- Instance methods (inherited) ----
 === __id__ __send__ _dump _load all? any? between? class
 collect detect display each_with_index entries eql? equal?
 extend find find_all freeze frozen? grep hash id initialize
 initialize_copy inject inspect instance_eval instance_of?
 instance_variable_get instance_variable_set
 instance_variables is_a? kind_of? map marshal_dump
 marshal_load max member? method method_missing methods min
 nil? object_id partition pretty_print pretty_print_cycle
 pretty_print_instance_variables private_methods
 protected_methods public_methods reject
 remove_instance_variable respond_to? select send
 singleton_method_added singleton_method_removed
 singleton_method_undefined singleton_methods sort sort_by
 taint tainted? to_a to_ary to_hash to_int type untaint zip

* はてなダイアリーキーワード:String

  • 2006/05/12 19:52:11 %
  • 2006/05/12 19:52:25 *
  • 2006/05/12 19:52:48 <
  • 2006/05/12 19:52:55 <<
  • 2006/05/12 19:53:03 <=
  • 2006/05/12 19:53:11 <=>
  • 2006/05/12 19:53:19 ==
  • 2006/05/12 19:53:33 =~
  • 2006/05/12 19:53:41 >
  • 2006/05/12 19:53:58 >=
  • 2006/05/15 12:03:11 at
  • 2006/05/15 12:05:56 capitalize
  • 2006/05/15 12:06:05 capitalize!
  • 2006/05/15 12:06:14 casecmp
  • 2006/05/15 12:06:30 center
  • 2006/05/12 19:55:27 CGI::Cookie
  • 2006/05/12 19:55:49 CGI::Session
  • 2006/05/15 12:07:02 chomp
  • 2006/05/15 12:07:10 chomp!
  • 2006/05/15 12:07:17 chop