Japanese numeral for Ruby kaigi by kenmaz(kaigi)

require 'jcode';$KCODE='u';m=["\xe4\xb8\x80","\xe4\xba\x8c","\xe4\xb8\x89","\xe5\x9b\x9b","\xe4\xba\x94","\xe5\x85\xad","\xe4\xb8\x83","\xe5\x85\xab","\xe4\xb9\x9d","\xe5\x8d\x81","\xe7\x99\xbe","\xe5\x8d\x83"];while l=gets;a,p=0,nil;l.strip!.each_char{|c|;n=m.index c;if n>=9;x=1;(n-8).times{x*=10};a+=(p||1)*x;p=nil;else;p=n+1;end;};a+=p if p;p a;end

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page