# 句子边界

> 原文： [https://docs.oracle.com/javase/tutorial/i18n/text/sentence.html](https://docs.oracle.com/javase/tutorial/i18n/text/sentence.html)

您可以使用`BreakIterator`来确定句子边界。首先使用`getSentenceInstance`方法创建`BreakIterator`：

```
BreakIterator sentenceIterator =
    BreakIterator.getSentenceInstance(currentLocale);

```

为了显示句子边界，程序使用`markBoundaries`方法，该方法在[字边界](word.html)一节中讨论。 `markBoundaries`方法在字符串下面打印插入符号（^）以指示边界位置。这里有些例子：

```
She stopped.  She said, "Hello there," and then went on.
^             ^                                         ^

He's vanished!  What will we do?  It's up to us.
^               ^                 ^             ^

Please add 1.5 liters to the tank.
^                                 ^

```