String.split ( ) ,是基于正则表达式 : 字符串分割 « 数据类型 « Java

En
Java
1. 图形用户界面
2. 三维图形动画
3. 高级图形
4. 蚂蚁编译
5. Apache类库
6. 统计图
7. 
8. 集合数据结构
9. 数据类型
10. 数据库JDBC
11. 设计模式
12. 开发相关类
13. EJB3
14. 电子邮件
15. 事件
16. 文件输入输出
17. 游戏
18. 泛型
19. GWT
20. Hibernate
21. 本地化
22. J2EE平台
23. 基于J2ME
24. JDK-6
25. JNDI的LDAP
26. JPA
27. JSP技术
28. JSTL
29. 语言基础知识
30. 网络协议
31. PDF格式RTF格式
32. 映射
33. 常规表达式
34. 脚本
35. 安全
36. Servlets
37. Spring
38. Swing组件
39. 图形用户界面
40. SWT-JFace-Eclipse
41. 线程
42. 应用程序
43. Velocity
44. Web服务SOA
45. 可扩展标记语言
Java 教程
Java » 数据类型 » 字符串分割屏幕截图 
String.split ( ) ,是基于正则表达式
 

public class Main {
  public static void main(String args[]) throws Exception {
    String s3 = "{A}{this is a test}{1234}";
    String[] words = s3.split("[{}]");
    for (String str : words) {
      System.out.println(str);
    }
  }
}
/*
A

this is a test

1234
*/

   
  
Related examples in the same category
1. The string passed to the split method is a regular expression
2. String.split(): " s".split(" ") -> {"","","s"}
3. String.split(): "".split("") (one empty string value array)
4. String.split(): " ".split(" ") -> {} (Empty array)
5. String.split(): " ".split(" ") ->(Empty array too)
6. String.split(): " s ".split(" ") -> {"","","s"} (!) (space before and after)
7. " ".split(" ") generates a NullPointerException
8. Using split() with a space can be a problem
9. 分割字符串使用String.split ( )
10. Split by dot
11. Special character needs to be escaped with a \
12. Escape special character with a \
13. 保持空字符串
14. 指定一个正则表达式匹配的一个或多个空格
15. 分割字符串
16. Using second argument in the String.split() method to control the maximum number of substrings generated by splitting a string.
17. Special characters needs to be escaped while providing them as delimeters like "." and "|".
18. Control the maximum number of substrings generated by splitting a string.
19. Split with regular expression
20. Pattern Splitting for space splittor
21. 分割字符串的模式:分裂("[-/%]")
22. Use split() to extract substrings from a string.
23. 分裂词的界限。
24. Split same string on commas and zero or more spaces.
25. Split on word boundaries, but allow embedded periods and @.
26. Split on various punctuation and zero or more trailing spaces.
27. Parsing Character-Separated Data with a Regular Expression
28. Parse a line whose separator is a comma followed by a space
29. Parse a line with and's and or's
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.