C# 哪个句子最大,包含多少个数字
你就快到了。如果使用System.Linq命名空间,这是最简单的:C# 哪个句子最大,包含多少个数字,c#,C#,你就快到了。如果使用System.Linq命名空间,这是最简单的: using System; namespace MyCSharpLearning { class StringProject { public int LargestSentenceInformation(string i) { string[] txt = i.Split(new char[] { '.', '?', '!', ',' });
using System;
namespace MyCSharpLearning
{
class StringProject
{
public int LargestSentenceInformation(string i)
{
string[] txt = i.Split(new char[] { '.', '?', '!', ',' });
var largeS=txt.Order
}
public static void Main(string[] args)
{
StringProject n = new StringProject();
string str1 = Console.ReadLine();
Console.ReadLine();
}
}
}
stringsorderedByLargest现在将包含从最长到最短的排序。如果要计算一个字符串的字数,只需进行另一次拆分,但这次是在“”上,并查看结果集合的count属性。请询问相关问题格式化。。。。。感谢所有正在编辑的人。我是C编程新手。我想知道如何写代码哪个句子最大,包含多少个单词。不清楚你在问什么。你的代码没有解释你想做什么这听起来很像是某人的编程作业向我提出的问题。。。
string[] txt = i.Split(new char[] { '.', '?', '!', ',' }); //this part you had correct
var stringsOrderedByLargest = txt.OrderByDescending(s => s.length);