Page tree
Skip to end of metadata
Go to start of metadata

This class is used to convert a sequence of bytes in a given codepage into a string or character variable.

Table of contents

Conversion

either CREATE + CONVERT

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
  DATA conv TYPE REF TO cl_abap_conv_in_ce.
  DATA buffer(4) TYPE x.
  DATA text(100) TYPE c.
  buffer = '41424332'. "bytes represent ABC2 in UTF-8
  conv = cl_abap_conv_in_ce=>create(
        encoding = 'UTF-8' ).
  conv->convert(
        EXPORTING input = buffer
        IMPORTING data = text ).
  ASSERT text = `ABC2`.

or CREATE + READ + SKIP_C (buffer of bytes with a pointer)

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
  DATA buffer(5) TYPE x.
  DATA conv TYPE REF TO cl_abap_conv_in_ce.
  DATA text(100) TYPE c.
  buffer = '4142433235'. "bytes represent ABC25 in UTF-8
  conv = cl_abap_conv_in_ce=>create(
         encoding = 'UTF-8'
         input = buffer ).
  CALL METHOD conv->read(
    EXPORTING n    = 2
    IMPORTING data = text ).
  ASSERT text = `AB`.
  CALL METHOD conv->skip_c(
    EXPORTING n    = 1 ).
  CALL METHOD conv->read(
    EXPORTING n    = 2
    IMPORTING data = text ).
  ASSERT text = `25`.

UCCP: converts a unicode code point (hexa representation) into a character

Unique parameter must be a string of exactly 4 characters, in hexadecimal representation (0 to 9, and A to F).

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA c2 TYPE c LENGTH 2.
c2 = cl_abap_conv_in_ce=>uccp( '0041' ).
ASSERT c2 = 'A'.
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA c4 TYPE c LENGTH 4.
DATA c2 TYPE c LENGTH 2.
c4 = '0041'.
c2 = cl_abap_conv_in_ce=>uccp( c4 ).
ASSERT c2 = 'A'.
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA x2 TYPE x LENGTH 2.
x2 = '0041'.
c2 = cl_abap_conv_in_ce=>uccp( x2 ).
ASSERT c2 = 'A'.

UCCPI: converts a unicode code point into a character

Unique parameter must be an integer.

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA c2 TYPE c LENGTH 2.
c2 = cl_abap_conv_in_ce=>uccpi( 65 ).
ASSERT c2 = 'A'.
  • No labels