使用索引从字符串中删除spec char [英] Remove spec char from a string using a index

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

问题描述

 

任何人都可以帮我解决如何使用索引从字符串中删除spec char的问题吗?我应该可以使用string.Remove方法,但我不知道如何。我希望它是这样的:

Can anyone help me with how to remove a spec char from a string using a index? I should be able to use the string.Remove method but I don't know how. I want it to be something like:

p ublic
static
string
remove_char string
str

int
n

{
return
str
删除 n
1 ;
}

public static string remove_char(string str, int n) { return str.Remove(n, 1); }




请帮忙!=)




例如:

输入: "Newyork"

Input: "Newyork"

输出:

Neyork

Newyrk

Neyork

推荐答案

String.Remove()在链接中,Bing和Google是你的朋友。

https://docs.microsoft.com/en-us/ dotnet / standard / base-types / trimming

https://docs.microsoft.com/en-us/dotnet/standard/base-types/trimming

https://www.dotnetperls.com/remove

https://www.c-sharpcorner.com/UploadFile/mahesh/add-remove-replace-strings-in-C-Sharp/





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

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