如何将字符串中的单词保存到表中? [英] How Do I Can Save The Words In A String To The Table?
本文介绍了如何将字符串中的单词保存到表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
helo,
你可以帮我解决问题吗?
如果我的inpus是一个字符串猫在墙上,那么我想输出像包含单个栏目如下:
row1 - Cat
row2 - is
row3 --on
row4 - -the
row5 --wall
helo,
Can you help me for following problem solving?
if my inpus a string "Cat is on the wall", then i want output like containing single column as follow:
row1 -- Cat
row2 --is
row3 --on
row4 --the
row5 --wall
推荐答案
使用string.Split
Use string.Split
string input = "Cat is on the wall";
string[] words = input.Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);
foreach (string word in words)
{
// process "word"
}
这篇关于如何将字符串中的单词保存到表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文