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: 

How to capitalize the first letter of each word in a sentence?

Former Member
0 Kudos

Can anyone please explain how to split a sentence at a comma, or space or hyphen in to words and capitalize the first letter of each word. But I don't know how many words the sentence contains.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

data : begin of itab occurs 0,

words(40),

end of itab.

data : v_sentence(1000).

data : lv_firstchar.

split v_sentence at ',' into table itab.

loop at itab.

translate itab-words+0(1) to upper case.

modify itab index sy-tabix.

endloop.

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check this out.

Regards,

RIch Heilman

Former Member
0 Kudos

HI,

data : begin of itab occurs 0,

words(40),

end of itab.

data : v_sentence(1000).

data : lv_firstchar.

split v_sentence at ',' into table itab.

loop at itab.

translate itab-words+0(1) to upper case.

modify itab index sy-tabix.

endloop.