[英]Check if String contains unicode character
I have a button whose text contains a black circle 我有一个按钮,其文本包含黑色圆圈
Button.Text = "This is the button text ●"
Later when I click on the button I need to check if the Text contains the circle character, however Button.Text.Contains("&x25CF;")
returns False 稍后,当我单击按钮时,我需要检查文本是否包含圆圈字符,但是Button.Text.Contains("&x25CF;")
返回False。
How can I search a string for the Unicode characters? 如何在字符串中搜索Unicode字符?
In C#, unicode character escape sequences are written as \●
, while ●
在C#中,Unicode字符转义序列写为\●
●
,而●
is XML or HTML. 是XML或HTML。
So you should write 所以你应该写
Text.Contains("\u25CF")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.