るりまサーチ

最速Rubyリファレンスマニュアル検索!
135件ヒット [101-135件を表示] (0.057秒)
トップページ > クラス:String[x] > クエリ:string[x] > クエリ:encode[x] > ライブラリ:ビルトイン[x]

別のキーワード

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

キーワード

検索結果

<< < 1 2 >>

String#casecmp?(other) -> bool | nil (9015.0)

大文字小文字の違いを無視し文字列を比較します。 文字列が一致する場合には true を返し、一致しない場合には false を返します。

...false
"abcdef".casecmp?("ABCDEF") #=> true
"\u{e4 f6 fc}".casecmp?("\u{c4 d6 dc}") #=> true
//}

nil は文字列のエンコーディングが非互換の時に返されます。

//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp?("\u{c4 d6 dc}") #=> nil
//}

@see String#casecmp...

String#each_codepoint -> Enumerator (9015.0)

文字列の各コードポイントに対して繰り返します。

...ます。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@see String#codepoints...

String#each_codepoint {|codepoint| block } -> self (9015.0)

文字列の各コードポイントに対して繰り返します。

...ます。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@see String#codepoints...

String#encoding -> Encoding (9009.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...
<< < 1 2 >>