从字符串中删除单个字符? [英] Remove single character from a string?

查看:170
本文介绍了从字符串中删除单个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何从一个字符串中删除单个字符

How would you remove a single character from a string?

string = string.Remove(3);



但它消除了第三char和一切。

but it removes the third char and everything else.

推荐答案

据remove方法签名

public string Remove(
    int startIndex,
    int count
)

您需要提供第二个参数为字符的总数从的startIndex <删除/ code>:

you need to provide a second parameter as the total number of characters to remove from startIndex:

string = string.Remove(3, 1);

这篇关于从字符串中删除单个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆