如何在c中修剪和追加for循環中的字符串我有一個字符串,如"\Examp"l'e"
,我想要的是從每個循環中使用它的示例:如何在c中修剪和追加for循環中的字符串#
string value = @"\Examp"l'e";
foreach(string trim in value)
{
if(trim == @"\")
{
\\how to trim the value like Examp"l'e
}
if(trim == @""")
{
\\again trim
}
if(trim == @"'")
{
\\again trim
}
}
我的最終輸出應爲:Example
考慮使用替代更換所有不想要的字符與'string.Empty' – Ian