c# - C# 如何删除字符串的第一个和最后一个字符?

标签 c#

String: "hello to the very tall person I am about to meet"

我希望它变成这样:

String: hello to the very tall person I am about to meet

我只能找到修剪开始的代码吗?

最佳答案

使用 String.Substring 方法。

因此,如果您的字符串存储在变量 mystr 中,请执行以下操作:

mystr = mystr.Substring(1, mystr.Length - 2);

关于c# - C# 如何删除字符串的第一个和最后一个字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42964150/

相关文章:

c# - Windows 8 XAML : Displaying a list of images in a GridView through data binding

c# - (OAuthException) 必须使用事件访问 token 来查询有关当前用户的信息

c# - 在执行过程中更改 web 服务地址

c# - 在 if block 中包围行的 VS2010 快捷方式是什么

c# - URL 以句点结尾的 WebClient 问题

c# - Silverlight 中的递归函数

javascript - 禁用 JavaScript 时的 ASP.NET LinkBut​​ton

c# - 如何编写谓词函数

c# - DataGridView 将文本放在 RowHeader 的 ColumnHeader 中

c# - Windows 8 商店应用程序 C# 中的 OpenGL 支持