Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
count of "Hello World"
|
||||
32
Task/String-length/AppleScript/string-length-2.applescript
Normal file
32
Task/String-length/AppleScript/string-length-2.applescript
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
set inString to "Hello é̦世界"
|
||||
set byteCount to 0
|
||||
|
||||
repeat with c in inString
|
||||
set t to id of c
|
||||
if ((count of t) > 0) then
|
||||
repeat with i in t
|
||||
set byteCount to byteCount + doit(i)
|
||||
end repeat
|
||||
else
|
||||
set byteCount to byteCount + doit(t)
|
||||
end if
|
||||
end repeat
|
||||
|
||||
byteCount
|
||||
|
||||
on doit(cid)
|
||||
set n to (cid as integer)
|
||||
if n > 67108863 then -- 0x3FFFFFF
|
||||
return 6
|
||||
else if n > 2097151 then -- 0x1FFFFF
|
||||
return 5
|
||||
else if n > 65535 then -- 0xFFFF
|
||||
return 4
|
||||
else if n > 2047 then -- 0x07FF
|
||||
return 3
|
||||
else if n > 127 then -- 0x7F
|
||||
return 2
|
||||
else
|
||||
return 1
|
||||
end if
|
||||
end doit
|
||||
|
|
@ -0,0 +1 @@
|
|||
count of "Hello World"
|
||||
|
|
@ -0,0 +1 @@
|
|||
count "Hello World"
|
||||
Loading…
Add table
Add a link
Reference in a new issue