all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,2 @@
input a$
print len(a$)

View file

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
puts "あいうえお".length
# => 5
puts "あいうえお".size # alias for length
# => 5

View file

@ -0,0 +1,4 @@
# -*- coding: iso-8859-1 -*-
s = "møøse"
puts "Byte length: %d" % s.bytesize
puts "Character length: %d" % s.length

View file

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
s = "møøse"
puts "Byte length: %d" % s.bytesize
puts "Character length: %d" % s.length

View file

@ -0,0 +1,4 @@
# -*- coding: gb18030 -*-
s = "møøse"
puts "Byte length: %d" % s.bytesize
puts "Character length: %d" % s.length

View file

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
class String
# Define String#bytesize for Ruby 1.8.6.
unless method_defined?(:bytesize)
alias bytesize length
end
end
s = "文字化け"
puts "Byte length: %d" % s.bytesize
puts "Character length: %d" % s.gsub(/./u, ' ').size