update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
1
Task/String-length/Aime/string-length.aime
Normal file
1
Task/String-length/Aime/string-length.aime
Normal file
|
|
@ -0,0 +1 @@
|
|||
length("Hello, World!")
|
||||
1
Task/String-length/Racket/string-length-1.rkt
Normal file
1
Task/String-length/Racket/string-length-1.rkt
Normal file
|
|
@ -0,0 +1 @@
|
|||
(define str "J\u0332o\u0332s\u0332e\u0301\u0332")
|
||||
2
Task/String-length/Racket/string-length-2.rkt
Normal file
2
Task/String-length/Racket/string-length-2.rkt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-> (printf "str has ~a characters" (string-length str))
|
||||
str has 9 characters
|
||||
2
Task/String-length/Racket/string-length-3.rkt
Normal file
2
Task/String-length/Racket/string-length-3.rkt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-> (printf "str has ~a bytes in utf-8" (bytes-length (string->bytes/utf-8 str)))
|
||||
str has 14 bytes in utf-8
|
||||
4
Task/String-length/Ruby/string-length-1.rb
Normal file
4
Task/String-length/Ruby/string-length-1.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
puts "あいうえお".bytesize
|
||||
# => 15
|
||||
7
Task/String-length/Ruby/string-length-2.rb
Normal file
7
Task/String-length/Ruby/string-length-2.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
puts "あいうえお".length
|
||||
# => 5
|
||||
|
||||
puts "あいうえお".size # alias for length
|
||||
# => 5
|
||||
4
Task/String-length/Ruby/string-length-3.rb
Normal file
4
Task/String-length/Ruby/string-length-3.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: iso-8859-1 -*-
|
||||
s = "møøse"
|
||||
puts "Byte length: %d" % s.bytesize
|
||||
puts "Character length: %d" % s.length
|
||||
4
Task/String-length/Ruby/string-length-4.rb
Normal file
4
Task/String-length/Ruby/string-length-4.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
s = "møøse"
|
||||
puts "Byte length: %d" % s.bytesize
|
||||
puts "Character length: %d" % s.length
|
||||
4
Task/String-length/Ruby/string-length-5.rb
Normal file
4
Task/String-length/Ruby/string-length-5.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: gb18030 -*-
|
||||
s = "møøse"
|
||||
puts "Byte length: %d" % s.bytesize
|
||||
puts "Character length: %d" % s.length
|
||||
12
Task/String-length/Ruby/string-length-6.rb
Normal file
12
Task/String-length/Ruby/string-length-6.rb
Normal 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
|
||||
2
Task/String-length/Run-BASIC/string-length.run
Normal file
2
Task/String-length/Run-BASIC/string-length.run
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
input a$
|
||||
print len(a$)
|
||||
Loading…
Add table
Add a link
Reference in a new issue