使用c#替换文本-字符文字中的字符过多 [英] replace text using c# -Too many characters in character literal
本文介绍了使用c#替换文本-字符文字中的字符过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用c#更改我在mvc编辑中使用的文本 我使用了以下代码,但出现错误
i'm trying to change text I have using c# , in my mvc edit I have use the following code but i'm getting error
字符太多..".
"Too many characters..".
这是我正在使用的代码:
this is the code i'm using :
public async Task<ActionResult> Edit([Bind(Include = "AboutId,AboutHeader,AboutText,PicAlt,Url")] About about)
{
about.AboutText = about.AboutText.Replace('{font-family: "Guttman Calligraphic"; font-size: 12pt; mso-ascii-font-family: David; mso-fareast-font-family: MingLiU-ExtB; mso-hansi-font-family: David;}, "")');
if (ModelState.IsValid)
{
谢谢
推荐答案
您正在使用对Replace
的错误覆盖,您需要使用以下代码:
You are using incorrect override of Replace
you need to use this:
about.AboutText = about.AboutText.Replace("{font-family: \"Guttman Calligraphic\"; font-size: 12pt; mso-ascii-font-family: David; mso-fareast-font-family: MingLiU-ExtB; mso-hansi-font-family: David;}","");
这篇关于使用c#替换文本-字符文字中的字符过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文