라이브러리
[PHP] IntlRuleBasedBreakIterator::getRuleStatus - 현재 중단 위치를 결정한 중단 규칙에서 가장 큰 상태 값을 가져옵니다.
IntlRuleBasedBreakIterator::getRuleStatus
`IntlRuleBasedBreakIterator::getRuleStatus` 메서드는 IntlRuleBasedBreakIterator 객체의 규칙 상태를 반환합니다. 이 메서드는 IntlRuleBasedBreakIterator 객체의 현재 상태를 알려주기 위해 사용됩니다.
IntlRuleBasedBreakIterator
`IntlRuleBasedBreakIterator`는 문자열을 분할하는 규칙을 기반으로 하는 분할자입니다. 이 분할자는 언어의 문법 규칙을 사용하여 문자열을 분할합니다.
getRuleStatus 메서드
`getRuleStatus` 메서드는 IntlRuleBasedBreakIterator 객체의 현재 규칙 상태를 반환합니다. 이 메서드는 다음 값을 반환할 수 있습니다.
* `IntlRuleStatus::ACTIVE`: 현재 규칙이 활성화되어 있습니다.
* `IntlRuleStatus::INACTIVE`: 현재 규칙이 비활성화되어 있습니다.
* `IntlRuleStatus::UNKNOWN`: 현재 규칙의 상태가 알려지지 않았습니다.
예제
다음 예제는 `IntlRuleBasedBreakIterator` 객체를 생성하고 `getRuleStatus` 메서드를 사용하여 규칙 상태를 반환하는 방법을 보여줍니다.
#hostingforum.kr
php
// IntlRuleBasedBreakIterator 객체를 생성합니다.
$iterator = new IntlRuleBasedBreakIterator('ko-KR');
// 문자열을 분할합니다.
$iterator->setText('안녕하세요. 한국어입니다.');
// 현재 규칙 상태를 반환합니다.
$status = $iterator->getRuleStatus();
// 규칙 상태를 출력합니다.
echo "현재 규칙 상태: $status
";
// 규칙 상태를 변경합니다.
$iterator->setRuleStatus(IntlRuleStatus::ACTIVE);
// 현재 규칙 상태를 반환합니다.
$status = $iterator->getRuleStatus();
// 규칙 상태를 출력합니다.
echo "현재 규칙 상태: $status
";
이 예제에서는 `IntlRuleBasedBreakIterator` 객체를 생성하고 문자열을 분할합니다. 그런 다음 `getRuleStatus` 메서드를 사용하여 현재 규칙 상태를 반환하고 출력합니다. 규칙 상태를 변경한 후 다시 `getRuleStatus` 메서드를 사용하여 현재 규칙 상태를 반환하고 출력합니다.
참고
* `IntlRuleStatus` 클래스는 IntlRuleBasedBreakIterator 객체의 규칙 상태를 나타내는 열거형입니다.
* `IntlRuleBasedBreakIterator` 클래스는 문자열을 분할하는 규칙을 기반으로 하는 분할자입니다.
* `getRuleStatus` 메서드는 IntlRuleBasedBreakIterator 객체의 현재 규칙 상태를 반환합니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.