拆分字符串 [英] to split the string

查看:96
本文介绍了拆分字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的字符串为first第二个第三个第四个 "第五" 第六个第七 eigth


我想把它溢出如下。


first

second

第三个

第四个

第五个

第六个第七个

eigth


请任何人帮我这个吗?

I am having a String as "first" second third "fourth" "fifth" "sixth seventh" eigth

I want to spilt it as follows.

first
second
third
fourth
fifth
sixth seventh
eigth

please can any one help me regarding this?

推荐答案

这实际上是使用数组和split()函数非常容易的事情。为什么不试一试,如果你遇到困难,请在这里发布你的代码(用代码标签括起来),我们会把你推向正确的方向。


问候,


杰夫
This is actually something that is very easy using an array and the split() function. Why don''t you give it a try and if you get stuck, post your code here (enclosed in code tags) and we will nudge you in the right direction.

Regards,

Jeff


我也有这个问题,我得到答案看:
http://bytes.com/forum/thread845485.html
I had also this problem and I get answer see:
http://bytes.com/forum/thread845485.html



我的字符串为first第二个第三个第四个 "第五" 第六个第七 eigth


我想把它溢出如下。


first

second

第三个

第四个

第五个

第六个第七个

eigth


请有人帮我这个吗?
I am having a String as "first" second third "fourth" "fifth" "sixth seventh" eigth

I want to spilt it as follows.

first
second
third
fourth
fifth
sixth seventh
eigth

please can any one help me regarding this?



这个学校的工作是什么?它是一个关于使用嵌入在引号内的字符串内的分隔符来分割字符串(或解析字符串)的经典课程。在您的情况下,分隔符似乎是一个空格而不是您在CSV文件中找到的逗号。

Is this school work of some kind? Its a classic lesson on splitting strings (or parsing strings) using a delimiter that is embedded inside the string inside of quotes. In your case the delimiter appears to be a space instead of a comma like you would find in a CSV file.


这篇关于拆分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆