Ansicht
Dokumentation

CL_ICU_BREAKITERATOR - ICU: Break Iterator

CL_ICU_BREAKITERATOR - ICU: Break Iterator

BAL Application Log Documentation   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
Diese Dokumentation steht unter dem Copyright der SAP AG.
SAP E-Book

Funktionalität

Die Klasse CL_ICU_BREAKITERATOR bietet die Möglichkeit Breakiteratoren verschiedenen Typs zu erzeugen:

  • CREATE_CHARACTER_INSTANCE,,Umbruchposition zwischen logischen Zeichen
  • CREATE_WORD_INSTANCE,,,,Umbruchposition zwischen Wörtern
  • CREATE_LINE_INSTANCE,,,,Mögliche Zeilenumbruchpositionen
  • CREATE_SENTENCE_INSTANCE,,,,Umbruchposition zwischen Sätzen

Sprachspezifische Besonderheiten können durch die Angabe einer Locale berücksichtigt werden.

Beziehungen

Beispiel

  data: l_iterator         type ref to cl_icu_breakiterator,
        l_locale            type icu_s_locale,
        l_locale_name      type icu_a_locale_name,
        l_off                type i,
        l_text               type string,
        l_count              type i.
                                                                

l_locale-language = 'D'.                                        
  try.                                                          
      call method cl_icu_breakiterator=>create_character_instance
        exporting                                              
          im_locale        = l_locale                          
          im_fallback_off  = 'X'                                
        importing                                              
          ex_locale_name   = l_locale_name                      
          ex_breakiterator = l_iterator.                        
    catch cx_icu_locale_not_available .                        
    catch cx_icu_other_error .                                  
  endtry.                                                      
                                                                
  l_text = 'Dies ist ein Text'.                                
                                                                

  call method l_iterator->settext                              
    exporting                                                  
      im_text = l_text.                                        

  l_off   = l_iterator->first( ).                              
                                                                
  while l_off <> cl_icu_breakiterator=>done.                    
    write :/ l_text+l_off.                                      
    l_off = l_iterator->next( 3 ).                              
  endwhile.                                                    

  l_off   = l_iterator->last( ).                                
                                                                
  while l_off <> cl_icu_breakiterator=>done.                    
    write :/ l_text+l_off.                                      
    l_off = l_iterator->next( -1 ).                            
  endwhile.                                                    

  l_count = l_iterator->count( l_text ).                        
  write :/ 'Count(text) = ', l_count. "#EC NOTEXT              

Hinweise

Weiterführende Informationen

Allgemeine Informationen über die ICU Internationalization Library ist

zu finden unter http://site.icu-project.org/.






ROGBILLS - Synchronize billing plans   rdisp/max_wprun_time - Maximum work process run time  
Diese Dokumentation steht unter dem Copyright der SAP AG.

Length: 11318 Date: 20240328 Time: 152029     sap01-206 ( 61 ms )