我正在做一个与解析相关的事情的android项目。假设我想将字符串拆分为自定义格式
我的弦
Power supply will be suspended in the following areas on 13-04-15 between 9.00 A.M. to 2.00 P.M. for maintenance work. NUNGAMBAKKAM AREA : Nungambakkam High road(Door no. 33 to 66), Ponnankipuram, Avenue road, New street. TI CYCLE AREA : Cholapuram Main road, Complete Thiruvenkata nagar, Stedford Hospital, Lenin nagar, Teachers colony, Sivananda nagar, Municipal Court and CTH road, Post office, Railway station road, School area, Ramapuram, South park st, Ambattur market, Thasildhar office
所以我想将字符串分成这样
Power supply will be suspended in the following areas on 13-04-15 between 9.00 A.M. to 2.00 P.M. for maintenance work
NUNGAMBAKKAM AREA
Nungambakkam High road(Door no. 33 to 66)
Ponnankipuram
Avenue road
...........
Thasildhar office
那么我怎样才能得到这个android.help我来获取值
最佳答案
(?<=[a-z])\.(?=\s*[A-Z])|[,:]
您可以尝试一下。请参阅演示。
https://regex101.com/r/sJ9gM7/88
对于java来说
(?<=[a-z])\\.(?=\\s*[A-Z])|[,:]
关于java - 使用正则表达式在Android中将字符串拆分为多个字符串,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29619483/