Olaan Expert Licensed User Longtime User Nov 16, 2012 #1 Hi all, Who is well known about Regex in B4A? Please explain me clearly? Could I match Thaiword with mp3 File? I don't know about using pattern. Best Regards Theera Last edited: Nov 16, 2012
Hi all, Who is well known about Regex in B4A? Please explain me clearly? Could I match Thaiword with mp3 File? I don't know about using pattern. Best Regards Theera
Erel B4X founder Staff member Licensed User Longtime User Nov 16, 2012 #2 You can test whether all (or some) of the characters are Thai characters with Asc keyword. You should first find the Unicode values of Thai characters. Upvote 0
You can test whether all (or some) of the characters are Thai characters with Asc keyword. You should first find the Unicode values of Thai characters.
Olaan Expert Licensed User Longtime User Nov 17, 2012 #3 Please give me the example: IsThai(word) as boolean? I don't know to use regex ? This is Thai unicode. Please help me give example i.e. How to coding function IsThai(word) as boolean ? P.S. Unicode Thai(UTF-8) is the same as Unicode Thai(UTF-8 without BOM)? Best Regards Theera Upvote 0
Please give me the example: IsThai(word) as boolean? I don't know to use regex ? This is Thai unicode. Please help me give example i.e. How to coding function IsThai(word) as boolean ? P.S. Unicode Thai(UTF-8) is the same as Unicode Thai(UTF-8 without BOM)? Best Regards Theera
Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2012 #4 You do not need to use Regex for this. You should check the value returned from Asc(SomeCharacter) and see whether it is in the block of Thai characters. Something like: Code: Sub IsThai(s As String) As Boolean For i = 0 To s.Length - 1 Dim codePoint As Int = Asc(s.CharAt(i)) If codePoint >= 0x0E00 AND codePoint <= 0x0E7F Then Return True Next Return False End Sub Upvote 0
You do not need to use Regex for this. You should check the value returned from Asc(SomeCharacter) and see whether it is in the block of Thai characters. Something like: Code: Sub IsThai(s As String) As Boolean For i = 0 To s.Length - 1 Dim codePoint As Int = Asc(s.CharAt(i)) If codePoint >= 0x0E00 AND codePoint <= 0x0E7F Then Return True Next Return False End Sub
Olaan Expert Licensed User Longtime User Nov 17, 2012 #5 Can I use pattern with regex()? Hi Erel, I have ever seen Java using Pattern, Pattern="[ก-ฮ0-9ฯ-๙]*" I don't know that Can I use pattern with regex()? If I can,then if I define "เอาะ"="-oh" then "เกาะ"="Koh" too. How to coding? P.S. "เกาะ" is mean "land" Best Regards Theera Last edited: Nov 17, 2012 Upvote 0
Can I use pattern with regex()? Hi Erel, I have ever seen Java using Pattern, Pattern="[ก-ฮ0-9ฯ-๙]*" I don't know that Can I use pattern with regex()? If I can,then if I define "เอาะ"="-oh" then "เกาะ"="Koh" too. How to coding? P.S. "เกาะ" is mean "land" Best Regards Theera
Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2012 #6 See Regex tutorial: Regular expressions tutorial It shouldn't be difficult to use this pattern. Upvote 0
Olaan Expert Licensed User Longtime User Nov 17, 2012 #7 Ask to learn more. Hi Erel, Is there a possibility or not that made error?,If I check many languages in your strategy post #4. I mean that data of langauges used in the same location between 0x0E00-0x0E7F. Best Regards Theera Last edited: Nov 17, 2012 Upvote 0
Ask to learn more. Hi Erel, Is there a possibility or not that made error?,If I check many languages in your strategy post #4. I mean that data of langauges used in the same location between 0x0E00-0x0E7F. Best Regards Theera
Erel B4X founder Staff member Licensed User Longtime User Nov 19, 2012 #8 Not sure what you mean. There is also no advantage of using Regex over the code I posted in post #4. Upvote 0