---
title: "How to replace a character “―” in a C# string?"  
description: "How to replace a character “―” in a C# string?"  
author: "Takeshi Okada"  
published: 2015-04-12  
updated: 2015-04-13  
canonical: https://www.mindstick.com/forum/23093/how-to-replace-a-character-in-a-c-sharp-string  
category: ".net"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to replace a character “―” in a C# string?

i need to [replace](https://yourviews.mindstick.com/view/81330/cow-antibody-research-in-usa-a-step-ahead-to-replace-plasma-therapy) this "―" [character](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in my c# [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) i used replace [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) in [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) ways it did't work. string and [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) example is below:

string str="The Organisation of abc [Cooperation](https://answers.mindstick.com/qa/30943/with-which-country-indian-cabinet-signed-the-agreement-on-scientific-and-technological-cooperation) ―OIC";

lbl.Text = str.Replace("—", "").Replace("&[amp](https://www.mindstick.com/forum/156207/what-is-amp);#8212", "");

## Replies

### Reply by Anonymous User

This is the case where copy-paste works - if you copy the character to string you are searching for it will work.

You also can use correct representation of Unicode charaters like:

lbl.Text = str.Replace("\u2015", "");


---

Original Source: https://www.mindstick.com/forum/23093/how-to-replace-a-character-in-a-c-sharp-string

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
