Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/kconv.rb
Instance Method Summary collapse
-
#iseuc ⇒ Object
call-seq: String#iseuc => true or false.
-
#isjis ⇒ Object
call-seq: String#isjis => true or false.
-
#issjis ⇒ Object
call-seq: String#issjis => true or false.
-
#isutf8 ⇒ Object
call-seq: String#isutf8 => true or false.
-
#kconv(to_enc, from_enc = nil) ⇒ Object
call-seq: String#kconv(to_enc, from_enc).
-
#toeuc ⇒ Object
call-seq: String#toeuc => string.
-
#tojis ⇒ Object
call-seq: String#tojis => string.
-
#tolocale ⇒ Object
call-seq: String#tolocale => string.
-
#tosjis ⇒ Object
call-seq: String#tosjis => string.
-
#toutf16 ⇒ Object
call-seq: String#toutf16 => string.
-
#toutf32 ⇒ Object
call-seq: String#toutf32 => string.
-
#toutf8 ⇒ Object
call-seq: String#toutf8 => string.
Instance Method Details
#iseuc ⇒ Object
call-seq:
String#iseuc => true or false
Returns whether self
‘s encoding is EUC-JP or not.
264 |
# File 'lib/kconv.rb', line 264 def iseuc; Kconv.iseuc(self) end |
#isjis ⇒ Object
call-seq:
String#isjis => true or false
Returns whether self
‘s encoding is ISO-2022-JP or not.
276 |
# File 'lib/kconv.rb', line 276 def isjis; Kconv.isjis(self) end |
#issjis ⇒ Object
call-seq:
String#issjis => true or false
Returns whether self
‘s encoding is Shift_JIS or not.
270 |
# File 'lib/kconv.rb', line 270 def issjis; Kconv.issjis(self) end |
#isutf8 ⇒ Object
call-seq:
String#isutf8 => true or false
Returns whether self
‘s encoding is UTF-8 or not.
282 |
# File 'lib/kconv.rb', line 282 def isutf8; Kconv.isutf8(self) end |
#kconv(to_enc, from_enc = nil) ⇒ Object
call-seq:
String#kconv(to_enc, from_enc)
Convert self
to to_enc
. to_enc
and from_enc
are given as constants of Kconv or Encoding objects.
205 206 207 208 |
# File 'lib/kconv.rb', line 205 def kconv(to_enc, from_enc=nil) from_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0] Kconv::kconv(self, to_enc, from_enc) end |
#toeuc ⇒ Object
call-seq:
String#toeuc => string
Convert self
to EUC-JP
224 |
# File 'lib/kconv.rb', line 224 def toeuc; Kconv.toeuc(self) end |
#tojis ⇒ Object
call-seq:
String#tojis => string
Convert self
to ISO-2022-JP
218 |
# File 'lib/kconv.rb', line 218 def tojis; Kconv.tojis(self) end |
#tolocale ⇒ Object
call-seq:
String#tolocale => string
Convert self
to locale encoding
254 |
# File 'lib/kconv.rb', line 254 def tolocale; Kconv.tolocale(self) end |
#tosjis ⇒ Object
call-seq:
String#tosjis => string
Convert self
to Shift_JIS
230 |
# File 'lib/kconv.rb', line 230 def tosjis; Kconv.tosjis(self) end |
#toutf16 ⇒ Object
call-seq:
String#toutf16 => string
Convert self
to UTF-16
242 |
# File 'lib/kconv.rb', line 242 def toutf16; Kconv.toutf16(self) end |
#toutf32 ⇒ Object
call-seq:
String#toutf32 => string
Convert self
to UTF-32
248 |
# File 'lib/kconv.rb', line 248 def toutf32; Kconv.toutf32(self) end |
#toutf8 ⇒ Object
call-seq:
String#toutf8 => string
Convert self
to UTF-8
236 |
# File 'lib/kconv.rb', line 236 def toutf8; Kconv.toutf8(self) end |