[英]replace text using c# -Too many characters in character literal
我正在嘗試使用c#更改文本,在我的mvc編輯中,我使用了以下代碼,但出現錯誤
“字符太多..”。
這是我正在使用的代碼:
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
替代,您需要使用以下Replace
:
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;}","");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.