列表项后缀删除 [英] list items suffix remove
本文介绍了列表项后缀删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在匹配含有文件的后缀的后缀后,我有项目列表
。
问题是我不能从单词中删除后缀在列表项中。是否有任何方法可以删除C中的后缀#
示例我有以下列表
[0] apple
[1] cat
[2]香蕉
[3]芒果
等等
i想要删除c#
解决方案
中的后缀'le',ana,'go'等等。具体如何做到这一点取决于你想要做什么。
但是......如果我们假设你有一个返回起始索引的后缀查找方法,则它非常简单:
List< string> noSuffixes = withSuffixes.Select(s = > s.Substring( 0 ,GetIndexOfSuffix(s))。 ToList(); < / string > 跨度>
I have list of item
after matching the suffixes from suffix containing file.
The problem is that i can't remove the suffixes from the word in list item. Is there any method to remove the suffixes in C#
example i have follow list
[0]apple
[1]cat
[2]banana
[3]mango
and so on
i want to remove suffixes 'le',ana, 'go' etc in c#
解决方案
Exactly how you would do this would depend on exactly what you are trying to do.
But...if we assume you have a suffix finding method that returns the starting index then it's pretty trivial:
List<string> noSuffixes = withSuffixes.Select(s => s.Substring(0, GetIndexOfSuffix(s)).ToList();</string>
这篇关于列表项后缀删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文