Java 我想用正则表达式断句

Java 我想用正则表达式断句,java,regex,split,Java,Regex,Split,我有以下几条线索 String checker="The United States is a federal union of 50 states. The original 13 states were the successors of the 13 colonies that rebelled against British rule." 我想把它分成几个部分,这样 String Values[]=new String[20]; Value[0]="The United States

我有以下几条线索

String checker="The United States is a federal union of 50 states. The original 13 states were the successors of the 13 colonies that rebelled against British rule."
我想把它分成几个部分,这样

String Values[]=new String[20];
Value[0]="The United States is a federal union of 50 states."
Value[1]="The original 13 states were the successors of the 13 colonies that rebelled against British rule."
也就是说,我想根据“
”来拆分它。我该怎么做?记住“
”用于正则表达式中的任何字符,这就是我被卡住的原因

写什么

values[]=checker.split("regular exprression..........");

(?您可以使用拆分函数。\用于指定“.”字符

for ( String s : checker.split( "\\." ) )
        System.out.println( s );

以这种方式断章取义可能非常脆弱,因此要小心你的输入。如果最初的13个州是13.5个殖民地的继承者呢?怎么会有13.5个殖民地?@MatiCicero太好了…….rofl:P@MatiCicero你当然是对的,但我的观点是…:)@MatiCicero:怎么样“革命战争时有250万殖民者”。
for ( String s : checker.split( "\\." ) )
        System.out.println( s );