日文全角check

React

		const regex = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g;
		if ( regex.test(fileName)) {
			newObj = {
				snackbarOpen: true,
				snackbarMessage: MessageHandler.Format("这是全角"),
				snackbarVariant: "error",
			};
		} 

 

VBA

'全角をチェック
Private Function hasZenkaku(ByVal str As String)
    
    Dim reg As Object
    Set reg = CreateObject("VBSCRIPT.REGEXP")
    reg.Pattern = "[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B"
 
    hasZenkaku = reg.test(str)
    
End Function

  

posted @ 2020-12-09 14:16  奥兰王子  阅读(240)  评论(0编辑  收藏  举报