Skip to content

Commit

Permalink
Add t/utf8lua.lua (test for utf8.len) (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
hymkor committed Aug 19, 2018
1 parent 5842909 commit 0145bb0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions t/utf8len.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local text="あいうえおかきくけこさしすせそ"

for i=1,string.len(text) do
for j=i,string.len(text) do
local len,err =utf8.len(text,i,j)
if len then
print(string.format("[%d:%d]=%d",i,j,len))
else
print(string.format("[%d:%d]=ERROR %s",i,j,err))
end
end
end

0 comments on commit 0145bb0

Please sign in to comment.