PHP Velho Oeste 2024

The IntlCodePointBreakIterator class

(No version information available, might only be in Git)

소개

This break iterator identifies the boundaries between UTF-8 code points.

클래스 개요

IntlCodePointBreakIterator extends IntlBreakIterator implements Traversable {
/* Constants */
const integer DONE = -1 ;
const integer WORD_NONE = 0 ;
const integer WORD_NONE_LIMIT = 100 ;
const integer WORD_NUMBER = 100 ;
const integer WORD_NUMBER_LIMIT = 200 ;
const integer WORD_LETTER = 200 ;
const integer WORD_LETTER_LIMIT = 300 ;
const integer WORD_KANA = 300 ;
const integer WORD_KANA_LIMIT = 400 ;
const integer WORD_IDEO = 400 ;
const integer WORD_IDEO_LIMIT = 500 ;
const integer LINE_SOFT = 0 ;
const integer LINE_SOFT_LIMIT = 100 ;
const integer LINE_HARD = 100 ;
const integer LINE_HARD_LIMIT = 200 ;
const integer SENTENCE_TERM = 0 ;
const integer SENTENCE_TERM_LIMIT = 100 ;
const integer SENTENCE_SEP = 100 ;
const integer SENTENCE_SEP_LIMIT = 200 ;
/* 메소드 */
public ReturnType getLastCodePoint ( void )
/* 상속된 메소드 */
public static ReturnType IntlBreakIterator::createCharacterInstance ([ string $"locale" ] )
public static ReturnType IntlBreakIterator::createCodePointInstance ( void )
public static ReturnType IntlBreakIterator::createLineInstance ([ string $"locale" ] )
public static ReturnType IntlBreakIterator::createSentenceInstance ([ string $"locale" ] )
public static ReturnType IntlBreakIterator::createTitleInstance ([ string $"locale" ] )
public static ReturnType IntlBreakIterator::createWordInstance ([ string $"locale" ] )
public ReturnType IntlBreakIterator::current ( void )
public ReturnType IntlBreakIterator::first ( void )
public ReturnType IntlBreakIterator::following ( string $"offset" )
public ReturnType IntlBreakIterator::getErrorCode ( void )
ReturnType intl_get_error_code ( void )
public ReturnType IntlBreakIterator::getErrorMessage ( void )
ReturnType intl_get_error_message ( void )
public ReturnType IntlBreakIterator::getLocale ( string $"locale_type" )
public ReturnType IntlBreakIterator::getPartsIterator ([ string $"key_type" ] )
public ReturnType IntlBreakIterator::getText ( void )
public ReturnType IntlBreakIterator::isBoundary ( string $"offset" )
public ReturnType IntlBreakIterator::last ( void )
public ReturnType IntlBreakIterator::next ([ string $"offset" ] )
public ReturnType IntlBreakIterator::preceding ( string $"offset" )
public ReturnType IntlBreakIterator::previous ( void )
public ReturnType IntlBreakIterator::setText ( string $"text" )
}

예약 상수

IntlCodePointBreakIterator::DONE

IntlCodePointBreakIterator::WORD_NONE

IntlCodePointBreakIterator::WORD_NONE_LIMIT

IntlCodePointBreakIterator::WORD_NUMBER

IntlCodePointBreakIterator::WORD_NUMBER_LIMIT

IntlCodePointBreakIterator::WORD_LETTER

IntlCodePointBreakIterator::WORD_LETTER_LIMIT

IntlCodePointBreakIterator::WORD_KANA

IntlCodePointBreakIterator::WORD_KANA_LIMIT

IntlCodePointBreakIterator::WORD_IDEO

IntlCodePointBreakIterator::WORD_IDEO_LIMIT

IntlCodePointBreakIterator::LINE_SOFT

IntlCodePointBreakIterator::LINE_SOFT_LIMIT

IntlCodePointBreakIterator::LINE_HARD

IntlCodePointBreakIterator::LINE_HARD_LIMIT

IntlCodePointBreakIterator::SENTENCE_TERM

IntlCodePointBreakIterator::SENTENCE_TERM_LIMIT

IntlCodePointBreakIterator::SENTENCE_SEP

IntlCodePointBreakIterator::SENTENCE_SEP_LIMIT

Table of Contents

add a note add a note

User Contributed Notes 1 note

up
0
Matt Kynx
1 year ago
An example of using this to find all the code points in a string that cannot be transliterated to Latin-ASCII:

<?php

$string
= "Народm, Intl gurus get paid €10000/hr 😁";

$latinAscii = Transliterator::create('NFC; Any-Latin; Latin-ASCII;');
$transliterated = $latinAscii->transliterate($string);

$codePoints = IntlBreakIterator::createCodePointInstance();
$codePoints->setText($transliterated);

foreach (
$codePoints->getPartsIterator() as $char) {
   
$ord = IntlChar::ord($char);
    if (
255 < $ord) {
        echo
IntlChar::charName($ord) . "\n";
    }
}
?>

Outputs:
EURO SIGN
GRINNING FACE WITH SMILING EYES
To Top