Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的文本文件中有以下文本行,
James is working in London this is a program developed in java Program is working
我想得到以大写字母开头的行
James is working in London Program is working
谢谢
对于英语,您可以使用此
^[A-Z].*
^ 用于行首。[AZ] 表示任何大写字母。
如果你使用更快:
if (Character.isUpperCase(line.charAt(0)) { System.out.println(line); }