"Texas Hold ' Em development record" LUA extracts strings in Chinese and English

Source: Internet
Author: User

Local TB = {}
Local Leninbyte = #str
Local i = 1
While I < (leninbyte + 1) do
Local curbyte = String.byte (str, i)
Local Sztype
Local Bytecount=1
If Curbyte>0 and curbyte<=127 then
If curbyte>=48 and curbyte<=57 then
sztype = ' num '
ElseIf (curbyte>=97 and curbyte<=122) or
(curbyte>=65 and curbyte<=90) then
Sztype = ' letter '
End
ByteCount = 1
ElseIf curbyte>=192 and curbyte<223 Then
ByteCount = 2
ElseIf curbyte>=224 and curbyte<239 Then
ByteCount = 3
ElseIf curbyte>=240 and curbyte<=247 Then
ByteCount = 4
End

Local char = string.sub (str, I, i+bytecount-1)
i = i + byteCount

Local item = {}
if ByteCount = = 1 Then
Item.type = Sztype and Sztype or "en"
Else
Item.type = "cn"
End

Item.value = Char

Table.insert (TB, item)
End

Texas Hold ' Em development note lua extracts Chinese and English in strings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.