module RCNB::Str
字符串增强 ## Example “`ruby require 'rcnb/str' using RCNB::Str
'Who NB?'.rcnb # => ȐȼŃƅȓčƞÞƦȻƝƃŖć 'ȐĉņþƦȻƝƃŔć'.rcnb_decode # => RCNB
! 'ȐĉņþƦȻƝƃŔć'.rcnb? # => RCNB
! 'not rcnb'.rcnb? # => nil “` @note
使用`using RCNB::Str`来细化String类
@since 0.2.0
Public Instance Methods
rcnb(encoding=nil)
click to toggle source
将字符串编码为RCNB密文 @param encoding 文本编码
# File lib/rcnb/str.rb, line 45 def rcnb(encoding=nil) RCNB.encode(self,encoding) end
rcnb?(encoding=nil)
click to toggle source
判断字符串是否为RCNB密文 @param encoding 文本编码 @return [String,nil] 若是RCNB密文,则返回解码结果,否则返回nil
# File lib/rcnb/str.rb, line 58 def rcnb?(encoding=nil) begin RCNB.decode(self,encoding) rescue ArgumentError nil end end
rcnb_decode(encoding=nil)
click to toggle source
将RCNB密文字符串解码 @param encoding 文本编码
# File lib/rcnb/str.rb, line 51 def rcnb_decode(encoding=nil) RCNB.decode(self,encoding) end