2008 Feb 05 9:44 AM
How do i split the words in letters?
example 'aaab' into a a a b
i need to find out the maximum value and minimum value for a sentence or word.
example: aaab
aaac
aaad
aaab will be minimum value.
aaad will be maximum value.
How do i split the words in letters?
example 'aaab' into a a a b
i need to find out the maximum value and minimum value for a sentence or word.
example: aaab
aaac
aaad
aaab will be minimum value.
aaad will be maximum value.
2008 Feb 05 9:49 AM
hi jocelyn,
To check which is maximum you can use greater than
operator.
example:
data: w_one(4) type c value 'aaab',
w_two(4) type c value 'aaad',
w_great(4) type c.
if w_one > w_two.
w_great = w_one.
else.
w_great = w_two.
endif.
'>' or 'gt' operator can be used on character types.
Regards,
Harimanjesh AN
2008 Feb 05 10:03 AM
DATA : l_var(10) VALUE 'AAAB',
l_final TYPE string,
str_len TYPE i,
pos TYPE i.
str_len = STRLEN( l_var ).
l_final = l_var+0(1).
DO str_len TIMES.
pos = sy-index.
CONCATENATE l_final l_var+pos(1) INTO l_final SEPARATED BY space.
ENDDO.
WRITE :/ l_final.
"maximum and minimum values you can find by comapring values just like numerics.
2008 Feb 05 10:09 AM
ANSWERS
How do i split the words in letters?
example 'aaab' into a a a b
U can use offsets
first find out the length of the word, loop that no-of times, take each character using offset
i need to find out the maximum value and minimum value for a sentence or word.
for this u can use < or > operators
Reward if useful
Narendra
2008 Feb 05 10:12 AM
Hello Jocelyn,
You can split the words into letter using the follwing code.
REPORT zsample.
DATA: text(10).
DATA: BEGIN OF itab OCCURS 0,
letters(1),
END OF itab.
text = 'abcdef'.
WHILE NOT text IS INITIAL.
itab = text+0(1).
APPEND itab.
SHIFT text LEFT BY 1 PLACES.
ENDWHILE.
LOOP AT itab.
WRITE: / itab.
ENDLOOP.comparing the sentence:
REPORT zsample.
DATA: text1(10), text2(10).
text1 = 'abcde'.
text2 = 'abcd'.
IF text1 < text2.
WRITE: / text2, 'is having more avlue'.
ELSEIF text1 > text2.
WRITE: / text1, 'is having more havlue'.
ELSE.
WRITE: / 'equal'.
ENDIF.Reward If Helpful.
Regards
--
Sasidhar Reddy Matli.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |