首页 \ 问答 \ 如何在代码隐藏中将Unicode字符设置为标签内容?(How to set Unicode character as Content of Label in the code-behind?)

如何在代码隐藏中将Unicode字符设置为标签内容?(How to set Unicode character as Content of Label in the code-behind?)

我有一个标签,看起来如下:

<Label Name="FalsePositiveInput" Content="&#x2713;">

这有效,但我怎么能在代码隐藏方面做到这一点? 我试过这个,但显然它不工作:

FalsePositiveInput.Content = "&#x2713;";

我想要显示的字符是复选标记符号


I have a Label that looks the following:

<Label Name="FalsePositiveInput" Content="&#x2713;">

This works but how can I do it in the code-behind? I tried this but obviously it's not working:

FalsePositiveInput.Content = "&#x2713;";

The character i want to display is a check mark symbol


原文:https://stackoverflow.com/questions/5431136
更新时间:2023-06-06 17:06

最满意答案

有不同的做法

  • 使用RTRIM并指定范围

喜欢

SELECT RIGHT('0' + RTRIM(MONTH('12-31-2012')), 2); 
  • 在将日期转换为文本后,使用Substring提取月份部分

喜欢

SELECT SUBSTRING(CONVERT(nvarchar(6),getdate(), 112),5,2)

小提琴

可能有其他方法来获得这个。


there are different ways of doing it

  • Using RTRIM and specifing the range:

like

SELECT RIGHT('0' + RTRIM(MONTH('12-31-2012')), 2); 
  • Using Substring to just extract the month part after converting the date into text

like

SELECT SUBSTRING(CONVERT(nvarchar(6),getdate(), 112),5,2)

see Fiddle

There may be other ways to get this.

相关问答

更多
  • 有不同的做法 使用RTRIM并指定范围 : 喜欢 SELECT RIGHT('0' + RTRIM(MONTH('12-31-2012')), 2); 在将日期转换为文本后,使用Substring提取月份部分 喜欢 SELECT SUBSTRING(CONVERT(nvarchar(6),getdate(), 112),5,2) 见小提琴 可能有其他方法来获得这个。 there are different ways of doing it Using RTRIM and specifing the r ...
  • ("0" + this.getDate()).slice(-2) 对于日期和类似: ("0" + (this.getMonth() + 1)).slice(-2) 这个月。 ("0" + this.getDate()).slice(-2) for the date, and similar: ("0" + (this.getMonth() + 1)).slice(-2) for the month.
  • 使用sprintf(或printf,如果你只是要打印它)。 my $month = sprintf("%02d", $startDate->month()); 它将零填充您的输入。 查看文档以了解有关格式参数的更多信息。 Use sprintf (or printf, if you're just going to print it). my $month = sprintf("%02d", $startDate->month()); It will zero-pad your input. Take ...
  • 你不能在javascript和php中做到这一点。 您可以将值保留为字符串并仅在需要验证它而不将int发送到服务器时使用parseInt,或者您可以将它们设为单位数字,将它们传递给服务器并在验证后进行验证又是一个两位数的字符串 You cannot do that in javascript and php. Either you will keep the value as a string and use parseInt only if you want to validate it without ...
  • 怎么样: // Assuming a more sensible format, where the logically most significant part // is the most significant part of the number too. That would allow sorting by // integer value to be equivalent to sorting chronologically. int day = date % 100; int month ...
  • Php有一个你可以使用的base_convert函数。 base_convert($i,10,36) 要获得填充格式,只需添加一个strtoupper和strpad即可 function convert_i_to_alphanumeric($digit) { return str_pad(strtoupper(base_convert($digit,10,36)),5,"0",STR_PAD_LEFT); } Php has a base_convert function you can use. ...
  • 要显示 (未捕获)最后两位数字,请参阅以下正则表达式: '\b\d{8}(?=\d{2}\b)' 查看正则表达式演示! 这将在两个数字之前找到8个数字,其中10个数字在字边界内包装。 由于(?= )是肯定的前瞻断言,因此它不会被匹配。 整个比赛可以被替换为: ******** 没有必要的捕获组。 To display (leave uncaptured) the last two digits, please see the following regex: '\b\d{8}(?=\d{2}\b)' ...
  • 由于您使用的是FluentValidation,因此您希望使用.Matches验证程序执行正则表达式匹配。 RuleFor(x => x.student_id).Matches("^\d{7}$").... 另一种选择是做这样的事情(如果student_id是一个数字): RuleFor(x => x.student_id).Must(x => x > 999999 && x < 10000000)... 或者,您可以使用GreaterThan和LessThan验证器,但上述内容更易于阅读。 还要注意, ...
  • 您需要使用(?=(\d{4}))正则表达式匹配重叠匹配。 请参阅正则表达式演示 正在使用的正则表达式都使用4位数的文本块,因此重叠值不匹配。 使用(?=...)正向前瞻,您可以测试输入字符串中的每个位置,并从这些位置捕获 4个数字块,而不消耗字符(即,不会将正则表达式引擎指针移动到这4个数字块之后的位置)。 C#演示 : var data = "2345678901"; var res = Regex.Matches(data, @"(?=(\d{4}))") .Cast
  • 您可以通过除以10然后将除法除数除以10来实现: int second = (number / 10) % 10; 一般来说,你可以把整数除以k的十次幂除以k最低有效数字。 将剩余除数除以k的十次幂相当于保持最后的k位数。 我怎么能一个一个地提取每个数字? 您可以使用%10取最后一位数字,然后将该数字从结尾删除/= 10 。 You can do it by dividing by ten and then taking the remainder of division by ten: int seco ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)