Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8851

Re: replace all occurrences of blanks only if it is preceded by space in string

$
0
0

Hello Sanjana,

Here is a sample of my suggestion.

 

 

Data: string1a(20) type C,

         string1b(20) type c,

         string1c(20) type c,

         string1d(20) type c.

 

 

Data: len1    type i,

         offset1 type i.

 

 

 

 

 

 

start-of-selection.

 

 

 

 

 

split at space string1 into string1a string1b string1c string1d.

 

*-->get the length of the first split

 

 

 

 

 

len1 = strlen(string1a)

 

*--> we interested in the last character...so get the offset

 

 

 

offset1 = len1 - 1.

 

 

 

 

*-->test to see if the last character is a delimiter.

 

 

 

if string1+offset1(1) eq ':'

 

 

 

concatenate string1a string1b into string1 separate by '_'.

 

 

 

else.

 

 

 

concatenate string1a string1b into string1.

 

 

 

endif.

 

 

 

 

 

*--> do the same for the other sub-strings...of course test to see if they are not initial.

 

 

Thank you,

John

<removed by moderator> if helpful. Or ask if you need more help

 

Message was edited by: Manish Kumar


Viewing all articles
Browse latest Browse all 8851

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>