rubyÈçºÎ¸ñʽ»¯Êý×Ö£¿£¨´ÓÓÒ±ßÆðÿÈýλһ¸ö¶ººÅ¸ô¿ª£©
Êý×Ö´ÓÓÒ±ßÆðÿÈýλÓÃÒ»¸ö¶ººÅ¸ô¿ª
1232445 ⇒ 1,232,445
---- ChangeStr.rbÄÚÈÝ ------------------------------------------
def change_str(num)
str = num.to_s
nil while str.gsub!(/(.*\d)(\d\d\d)/, '\1,\2')
return str
end
s = change_str(1243245)
puts s
---- 執ÐÐ -------------------------
C:\WINDOWS>ruby ChangeStr.rb
1,243,245
×Ô¼º½â決! hehe
ллtaito¡¢ÕÒµ½ÁË¡ý
http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html
Ïà¹ØÎÊ´ð£º
ÎÒ×Ô¼ºÐ´ÁËÒ»¸ö¿âÎļþ£¬¿âÎļþÄÚ²¿Ã»ÎÊÌâ¡£ÎÒÏÖÔÚÏëÓà ruby£¨rpgÀµ÷ÓÃÕâ¸ö¿â£¬ÏÖÔÚÎÊÌâ³öÀ´ÁË£¬±¨´í£¬ËµµÄÊÇGetProcAddress : nSrv or nSrvA ºÃÏñÊDz»ÄÜÕÒµ½Õâ¸öº¯Êý°É£¬ nSrv ÊÇÎÒ¿âÎļþÀïµÄÒ»¸öº¯ÊýµÄÃû× ......
Ruby ´úÂëÈçÏ£º
class Array
def uniq_by
seen = {}
select{ |x|
v = yield(x)
!seen[v] && (seen[v]=true)
}
end
end
Çója ......
¸øJavascriptºÍRuby¿ª¸öÂÛ̳רÀ¸°É!
¸øJavascriptºÍRuby¿ª¸öÂÛ̳רÀ¸°É!
¸øJavascriptºÍRuby¿ª¸öÂÛ̳רÀ¸°É!
JavascriptÓÐרÀ¸µÄ£ºhttp://forum.csdn.net/SList/JavaScript
×ð¾´µÄÓû§deping_chen£¬ÄúºÃ£º ......
ÐÂÄê¸Õ¿ªÊ¼,ÒѾÓÐһЩÉúÃ͵ÄÅóÓÑÒª¿ªÊ¼ÐµÄÖ°³¡ÉúÑÄÁË,
²»ÖªµÀ»á²»»áÓöµ½ÕâÑùµÄÎÊÌâ: ÏëÕÒÒ»·ÝRuby on railsµÄ¹¤×÷,ÎÒÓ¦¸ÃÖªµÀÄÄЩ֪ʶ ?
»¹ºÃ,ÎÒ²¢²»ÊÇÏëÖ¸µãÄãʲô,Ö»ÊÇÏë°´ÎÒµÄ˼ά·½Ê½Õ¹ ......
ÎÒÔÚruby on railsÉÏÖ´ÐÐϵͳÃüÁµ«ÊǸÃϵͳÃüÁÔÚÎÒĬÈϵÄ·¾¶ÉÏÖ´Ðеģ¬¼´/var/www/my¡£ÏÖÔÚÎÒÓÃrubyÓïÑÔ±à³Ì£¬¿É´´½¨ÁËÒ»¸öÐÂĿ¼aaa£¨system "mkdir aaa"¼´¿É£©£¬µ«ÊÇÎÒ²»ÄܽøÈëaaaĿ¼Ï½øÐвÙ×÷ ......