偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

迅速掌握Ruby轉(zhuǎn)義字符

開(kāi)發(fā) 開(kāi)發(fā)工具
我們?cè)谶@里為大家詳細(xì)介紹了有關(guān)Ruby轉(zhuǎn)義字符的相關(guān)用法,希望大家可以通過(guò)本文介紹的內(nèi)容深入了解Ruby語(yǔ)言的相關(guān)知識(shí)。

Ruby轉(zhuǎn)義字符對(duì)于一個(gè)初學(xué)Ruby語(yǔ)言來(lái)說(shuō)是一個(gè)比較陌生的用法。在下面這篇文章中我們將會(huì)學(xué)到一些關(guān)于Ruby轉(zhuǎn)義字符的相關(guān)用法。#t#

Ruby轉(zhuǎn)義字符代碼示例:

 

 

  1. #! /usr/local/bin/ruby  
  2. # Author: xlzhu  
  3. # date: 2009-12-08  
  4. # Summary: encode string.  
  5.  
  6. class IEncoder  
  7. def initialize  
  8. end  
  9.  
  10. # Execute the given file using 
    the associate app  
  11. def run(orgStr)  
  12. str = orgStr 
  13. strstr = str.gsub('<', '&lt;')  
  14. strstr = str.gsub('>', '&gt;')  
  15. strstr = str.gsub(/['"]/, '&quot;')  
  16. strstr = str.lstrip #去掉前后空格  
  17. strstr = str.delete("\n\r") #去掉換行符  
  18. strstr = str.delete(" ")#去掉tab  
  19. puts str  
  20. end  
  21.  
  22. end 


iencoder = IEncoder.new
txt = IO.read("renderers.xml")
puts txt
iencoder.run(txt)

以上就是Ruby轉(zhuǎn)義字符的相關(guān)使用方法介紹。

責(zé)任編輯:曹凱 來(lái)源: 新浪博客
相關(guān)推薦

2009-12-14 17:23:31

2009-12-16 10:57:16

Ruby文件鎖

2009-12-14 16:35:28

Ruby文件行數(shù)計(jì)算

2009-12-18 14:19:45

Ruby on Rai

2009-12-10 14:18:22

PHP導(dǎo)出Word文檔

2009-12-14 18:23:38

Ruby DSL測(cè)試

2010-01-12 10:19:02

VB.NET操作GDI

2009-10-29 13:38:05

VB.NET Shar

2010-01-11 14:28:14

VB.NET操作Exc

2009-12-04 14:23:33

PHP JSON加密函

2009-12-11 16:39:08

PHP引號(hào)轉(zhuǎn)義

2009-12-17 14:36:57

Ruby on Rai

2010-01-07 11:07:20

VB.NET讀取INI

2009-06-28 22:56:00

虛擬化桌面虛擬化問(wèn)題

2010-01-08 18:10:44

VB.NET實(shí)現(xiàn)任務(wù)欄

2009-12-16 17:31:30

Ruby on Rai

2010-07-14 15:32:21

Perl轉(zhuǎn)義字符

2009-08-17 17:04:29

C#轉(zhuǎn)義字符

2009-12-14 13:19:07

Ruby字符串

2010-05-24 09:57:08

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)