check if string contains special unicode charset function

Get help with using AutoHotkey and its commands and hotkeys
majstang
Posts: 89
Joined: 11 Feb 2018, 03:39

check if string contains special unicode charset function

15 Aug 2020, 08:40

Hi,

Do any of you know of any good functions that can do this?
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: check if string contains special unicode charset function

15 Aug 2020, 08:51

majstang wrote:
15 Aug 2020, 08:40
Do any of you know of any good functions that can do this?
maybe the built-in RegExMatch :?: - example for Cyrillics:

Code: Select all

; https://unicode-table.com/en/blocks/cyrillic/
KomiDe := Chr(1280) ; Cyrillic Capital Letter Komi De (https://unicode-table.com/en/blocks/cyrillic-supplement/)
strings := ["привет товарищ!", "привет camarade!", "salut camarade!", KomiDe]

for each, string in strings
	MsgBox % containsCyrilic := RegExMatch(string, "\p{Cyrillic}") ; http://www.pcre.org/pcre.txt
	; MsgBox % containsCyrilic := (string ~= "\p{Cyrillic}") ; same as above
hope this helps

A_AhkUser
my scripts
majstang
Posts: 89
Joined: 11 Feb 2018, 03:39

Re: check if string contains special unicode charset function

15 Aug 2020, 15:57

HI A_AhkUser,

My hopes was some AHK power user already wrote a function covering the whole unicode table. Searching this site doesnt bring much unfortunately. I came to think about the easy way out here, how about checking if the string is ANSI.? If it's not it surely is unicode :)

EDIT: Maybe something like this https://www.autohotkey.com/boards/viewtopic.php?t=14629

Code: Select all

MsgBox % "Text is " (RegexMatch(string,"[\x{0100}-\x{FFFF}]")?"Unicode":"ANSI")

Return to “Ask For Help”

Who is online

Users browsing this forum: anv, DaveT1, JoeWinograd, LakaiHigh, mikeyww, RayB, TheProdigyC2, TXShooter and 75 guests