解析和拆分字符串(Parsing and splitting a String)

编程入门 行业动态 更新时间:2024-10-27 20:25:47
解析和拆分字符串(Parsing and splitting a String)

我想格式化一个字符串“Event”

当我打印它。 它给我的结果如下:

When : Wed 18 Apr 2012 04:30 to Wed 18 Apr 2012 06:30 Who: test@gmail.com Event status : Confirmed.

它给出了这三个类别的答案。

Who,when and Event Status 。

但我希望这三个结果在一个单独的字符串。如何格式化这些字符串,以便我将单独得到它

I want to format one string "Event"

When I print it. it gives me result like :

When : Wed 18 Apr 2012 04:30 to Wed 18 Apr 2012 06:30 Who: test@gmail.com Event status : Confirmed.

It gives answers in this 3 category.

Who,when and Event Status.

But i want these three results in a separate string .How to format these string so that i ll get it seperately

最满意答案

String[] parts = resultString.split("\n+");

这将通过输入( \n+表示一个或多个新行符号)拆分字符串,并将零件存储在parts数组中

String[] parts = resultString.split("\n+");

This will split your string by enters (\n+ means one or more new line symbol) and store parts in parts array

更多推荐

本文发布于:2023-07-24 00:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1239126.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   Parsing   String   splitting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!