View previous topic :: View next topic
|
Author |
Message |
anurag_vma
New User
Joined: 28 Jun 2006 Posts: 1 Location: noida
|
|
|
|
Hi,
I need to change one string,
from: micheal learns to rock
to: Micheal Learns To Rock
means every first character should be in Caps.
Constraints:
1- there could be more than one blank between two characters
2-need to place the words exactly on the same location as they were initially
-Anurag Verma |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
You will have to initiate a loop (PERFORM VARYING), keep the last character, and if it blank, change the current one with UPPER-CASE function.
O. |
|
Back to top |
|
|
Aji
New User
Joined: 03 Feb 2006 Posts: 53 Location: Mumbai
|
|
|
|
Hi
Please check the following method.
working-storage section.
01 a pic x(30).
01 j pic 99 value 1.
01 i pic 99 value 0.
01 b pic x value spaces.
01 m.
02 n occurs 30 times.
03 ws-temp pic x.
procedure division.
p1.
ACCEPT A.
perform p2 varying i from 1 by 1 until i > 30.
display m.
stop run.
p2.
move a(i:1) to b.
if a(i:1) = spaces
compute j = i + 1.
if j = i
inspect b converting "abcdefghijklmnopqrstuvwxyz"
to "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
move b to ws-temp(i).
Regards
Aji Cherian |
|
Back to top |
|
|
|