Search


Wednesday, March 18, 2009

How to remove the last Letter or char in c#

//I have here a sample text

string m_Value = "Testing 1| Testing 2 | Testing 3 |";

//and then i want to remove the last char " |"


string m_NewValue = m_Value.Substring(0, m_Values.Length - 2);

the output will be:

"Testing 1| Testing 2 | Testing 3"


Hope this help..

No comments:

Post a Comment