2009”N08ŒŽ12“ú

ruby‚Ńtƒ@ƒCƒ‹‚Ì“à—e‚̈ꕔ‚ð’uŠ·‚·‚é

sample.txtƒtƒ@ƒCƒ‹‚Ì“à—e‚́u‚è‚ñ‚²v‚ðuƒpƒCƒiƒbƒvƒ‹v‚É’uŠ·‚µ‚Ü‚·

sample.txt-------------------------------
‚è‚ñ‚²
‚Ô‚Ç‚¤
‚³‚­‚ç‚ñ‚Ú
ƒoƒiƒi
ƒIƒŒƒ“ƒW
sample.txt end--------------------------

ˆÈ‰ºAƒXƒNƒŠƒvƒg‚É‚È‚è‚Ü‚·

#file_gsub.rb----------------------------------------

f=File.open("C:/myrubyseesaa/sample.txt","r")
buffer = f.read();
p buffer
# ’†g‚ð•ÏŠ·
buffer.gsub!("‚è‚ñ‚²" , "ƒpƒCƒiƒbƒvƒ‹");
p buffer
f=File.open("C:/myrubyseesaa/sample.txt","w")
f.write(buffer)
f.close()


#
ã‹LAƒXƒNƒŠƒvƒg‚ðŽÀs‚·‚é‚ɂ́A
ƒRƒ}ƒ“ƒhƒvƒƒ“ƒvƒg‚ÅrubyƒXƒNƒŠƒvƒg‚ðŽÀs‚·‚é
NetBeans‚ÅrubyƒXƒNƒŠƒvƒg‚ðŽÀs‚·‚é
SciTEƒGƒfƒBƒ^‚ÅrubyƒXƒNƒŠƒvƒg‚ðŽÀs‚·‚é
‚Ì“àAD‚Ý‚Ì•û–@‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚��

#ŽQlæ
ruby‚Ńtƒ@ƒCƒ‹‚Ì’†g‚ð‘‚«Š·‚¦‚éƒTƒ“ƒvƒ‹‚Q

ƒ‰ƒxƒ‹Fruby
posted by sige at 23:40| Comment(2) | ruby | XVî•ñ‚ðƒ`ƒFƒbƒN‚·‚é
‚�}‚Ì‹LŽ–‚ւ̃Rƒƒ“ƒg
‚�}‚Ì•û–@‚¾‚Æ‘S‚ď㏑‚«‚Å‚·‚æ‚ˁB
ƒf[ƒ^‚ª‘½‚��‚Æ‚»‚ꂾ‚¯ŽžŠÔ‚ª‚©‚©‚é‚Ƃ��‚¤‚�}‚Æ‚É‚È‚é‚̂ł́H
Posted by “߁X at 2010”N03ŒŽ09“ú 16:33
‚Å‚·‚æ‚ˁB‚à‚Á‚Ƃ��‚��•û–@‚ªEEE
Posted by sige at 2010”N03ŒŽ30“ú 14:23
ƒRƒƒ“ƒg‚ð‘‚­
‚�N–¼‘O:

ƒ[ƒ‹ƒAƒhƒŒƒX:

ƒz[ƒ€ƒy[ƒWƒAƒhƒŒƒX:

ƒRƒƒ“ƒg: