更新时间:2023-12-04 20:44:34
中的后缀'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>