`
counsellor
  • 浏览: 4099 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论
文章列表
我有一段文本: str_encode = "MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\nMTExMTExMTExMTExMQ==\n"  想替换其中的"\n"为"\r\n",就是把<LF>全局替换为<CRLF>   代码如下: irb(main):037:0> m = a.gsub(/\n/, "\r\n") => "MTExMTExMTExMTExMTExMTExMTExMT ...
str_raw = "To be prepared is half the victory." str_encoded = [str_raw].pack('m')  或者 ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"].pack("m") => "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJT\nVFVWV1hZWg==\n"   上面两段代码是ruby提供 ...
Global site tag (gtag.js) - Google Analytics