在C#Windows窗体中需要帮助吗? [英] Need help in c# windows form ?
问题描述
如何在以下情况下使用循环或条件...
前任.我有一条文字今天太热了.明天会下雨.昨天很潮湿"
因此,如果使用任何循环(用于)或条件,那么我该怎么做:当您发现第一个dot(.")停下来并在点之前接受句子,然后继续进行下一个dot(."),然后再抽泣并接受之前的句子点...并继续到最后一个点:
输出为:
今天太热了
------------------
明天会下雨
------------------
昨天是湿的
------------------
thnx
How to use a loop for, or a condition if...
ex. I have a text "Today is so hot. Tomorrow will rain. Yesterday was wet"
so using any loop (for) or condition if, how can I do that: When you find first dot(".") stop and take sentence before dot, then continue for next dot(".") again sotp and take sentence before dot... and to continue till last dot :
the output to be:
Today is so hot
------------------
Tomorrow will rain
------------------
Yesterday was wet
------------------
thnx
推荐答案
拆分功能是否存在任何问题.
您可以尝试
Did you have any problem with Split function.
You can try as
string s = "Today is so hot. Tomorrow will rain. Yesterday was wet.";
string[] words = s.Split(Convert.ToChar('.'));
foreach (string ss in words)
{
Console.WriteLine(ss);
}
Console.ReadKey();
告诉我您可以做到这一点的想法
replace(您的句子",.",")
如果要通过循环
tell me the idea u can do this like this
replace("Your Sentence ",".","")
if you want through loop
for (a=0 , a<sentence.length,>{
if (sentence.index[a] !=".")
{
new_Sentence=new_sentence+sentence.index[a];
}
}
代码包含语法错误.但是逻辑很清楚
code contain syntax error . But the logic is clear
这篇关于在C#Windows窗体中需要帮助吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!