別のキーワード
キーワード
- << (12)
- b (12)
- casecmp (12)
- concat (21)
- encode (36)
- encode! (24)
-
force
_ encoding (12) - iseuc (12)
- scrub (36)
- scrub! (36)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - unpack (12)
-
valid
_ encoding? (12)
検索結果
先頭5件
-
String
# <<(other) -> self (26.0) -
self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。
...合は other.chr(self.encoding) 相当の文字を末尾に追加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文......字AのASCIIコード
p str # => "stringXXXYYYA"
//}... -
String
# concat(other) -> self (26.0) -
self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。
...合は other.chr(self.encoding) 相当の文字を末尾に追加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文......字AのASCIIコード
p str # => "stringXXXYYYA"
//}... -
String
# unicode _ normalize(form = :nfc) -> String (26.0) -
self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列を返します。
...規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。
@raise Encoding::CompatibilityError self が Unicode 文字列ではない場合
に発生します。
このメソッド......なっています。
//emlist[例][ruby]{
"a\u0300".unicode_normalize # => 'à' ("\u00E0" と同じ)
"a\u0300".unicode_normalize(:nfc) # => 'à' ("\u00E0" と同じ)
"\u00E0".unicode_normalize(:nfd) # => 'à' ("a\u0300" と同じ)
"\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nf......d)
# => Encoding::CompatibilityError raised
//}
@see String#unicode_normalize!, String#unicode_normalized?... -
String
# unicode _ normalized?(form = :nfc) -> bool (26.0) -
self が引数 form で指定された正規化形式で Unicode 正規化された文字列か どうかを返します。
...す。省略した場合は :nfc になります。
@raise Encoding::CompatibilityError self が Unicode 文字列ではない場合
に発生します。
//emlist[例][ruby]{
"a\u0300".unicode_normalized? # => false
"a\u0300".unicode_normali......=> true
"\u00E0".unicode_normalized? # => true
"\u00E0".unicode_normalized?(:nfd) # => false
"\xE0".force_encoding('ISO-8859-1').unicode_normalized?
# => Encoding::CompatibilityError raised
//}
@see String#unicode_normalize, String#unicode_normalize!... -
String
# <<(other) -> self (24.0) -
self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。
...合は other.chr(self.encoding) 相当の文字を末尾に追加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文......字AのASCIIコード
p str # => "stringXXXYYYA"
//}... -
String
# concat(other) -> self (24.0) -
self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。
...合は other.chr(self.encoding) 相当の文字を末尾に追加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文......字AのASCIIコード
p str # => "stringXXXYYYA"
//}... -
String
# casecmp(other) -> -1 | 0 | 1 | nil (20.0) -
String#<=> と同様に文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。
...
String#<=> と同様に文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。
このメソッドの動作は組み込み変数 $= には影響されません。
@param other self と比較する文字列
//emlist[例][ruby]{
"aBcDe......=> 0
"aBcDeF".casecmp("abcdefg") #=> -1
"abcdef".casecmp("ABCDEF") #=> 0
//}
nil は文字列のエンコーディングが非互換の時に返されます。
//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4 d6 dc}") #=> nil
//}
@see String#<=>, Encoding.compatible?......
String#<=> と同様に文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。
このメソッドの動作は組み込み変数 $= には影響されません。
String#casecmp? と違って大文字小文字の違いを無視するの......字列
//emlist[例][ruby]{
"aBcDeF".casecmp("abcde") #=> 1
"aBcDeF".casecmp("abcdef") #=> 0
"aBcDeF".casecmp("abcdefg") #=> -1
"abcdef".casecmp("ABCDEF") #=> 0
//}
nil は文字列のエンコーディングが非互換の時に返されます。
//emlist[][ruby]{
"\u{e4 f6 fc}".enco......de("ISO-8859-1").casecmp("\u{c4 d6 dc}") #=> nil
//}
@see String#<=>, Encoding.compatible?... -
String
# iseuc -> bool (20.0) -
self が EUC-JP なバイト列として正当であるかどうかを判定します。
...iseuc(self) と同じです。
//emlist[例][ruby]{
require 'kconv'
euc_str = "\
\xa5\xaa\xa5\xd6\xa5\xb8\xa5\xa7\xa5\xaf\xa5\xc8\xbb\xd8\xb8\xfe\
\xa5\xd7\xa5\xed\xa5\xb0\xa5\xe9\xa5\xdf\xa5\xf3\xa5\xb0\xb8\xc0\xb8\xec\
\x52\x75\x62\x79".force_encoding('EUC-JP')
sjis_str = "\
\x83\x49\x83\x75\x8......3\x57\x83\x46\x83\x4e\x83\x67\x8e\x77\x8c\xfc\
\x83\x76\x83\x8d\x83\x4f\x83\x89\x83\x7e\x83\x93\x83\x4f\x8c\xbe\x8c\xea\
\x52\x75\x62\x79".force_encoding('Shift_JIS')
euc_str.iseuc # => true
sjis_str.iseuc # => false
//}... -
String
# concat(*arguments) -> self (16.0) -
self に複数の文字列を破壊的に連結します。
...を末尾に追加します。追加する文字のエンコーディングは self.encoding です。
self を返します。
@param arguments 複数の文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "foo"
str.concat
p str # => "foo"
str = "foo"
str.concat "bar", "baz"
p s... -
String
# unicode _ normalize!(form = :nfc) -> self (14.0) -
self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列に置き換えます。
...す。省略した場合は :nfc になります。
@raise Encoding::CompatibilityError self が Unicode 文字列ではない場合
に発生します。
//emlist[例][ruby]{
text = "a\u0300"
text.unicode_normalize!(:nfc)
text == "\u00E0"......# => true
text.unicode_normalize!(:nfd)
text == "a\u0300" # => true
//}
@see String#unicode_normalize, String#unicode_normalized?...