Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Split String

Former Member
0 Kudos

Hi all,

How can i split a string character by character?

Best regards,

Munur

6 REPLIES 6

Former Member
0 Kudos

hi there ....

get the length of the string... then put a loop on the length...

use SPLIT command for index 1 till the loop ends...

i hope this helps...

regards

Former Member
0 Kudos

Below is the syntax:

SPLIT <c> AT <del> INTO <c1>... <cn> INTO TABLE <itab>.

This statement searches the character field <c> for delimiter strings <del> and the parts before and after the delimiters are placed in the target fields <c1> ...> u2026 <cn>, or into a new line of the internal table <itab>. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions.

Try to use this if this could help you.

Former Member
0 Kudos

Hi

DATA: lv_string TYPE string VALUE 'sathar',
      lv_lines TYPE i,
      lv_char TYPE c,
      lv_offset TYPE i.

lv_lines = STRLEN( lv_string ).

do lv_lines TIMES.

  lv_char = lv_string+lv_offset(1).
  WRITE : / lv_char.

  add 1 to lv_offset.

enddo.

Regards

Sathar

Former Member
0 Kudos

Press F1 on SPLIT. You will get syntax for the same.

Former Member
0 Kudos

Hi,

Refer following code

DATA : NAME TYPE STRING.

DATA : COUNT TYPE I,

CNT TYPE I.

data ch.

COUNT = STRLEN( NAME ).

do.

if cnt = count

exit.

endif.

ch = name+cnt(1).

cnt = cnt + 1.

enddo.

regards,

Pritish

Former Member
0 Kudos

You want to split character by character, do it this way.

len = strlen( p_string ).
do len times.
ch = p_string+0(1) " here you get character by character in p_string+0(1) in every cycle, manipulate according to your need
shift p_string circular.
enddo.

Regards,

Lalit Mohan Gupta.