Application Development and Automation 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: 
Read only

Hello Gurus!!

Former Member
0 Likes
545

I want to replace the unwanted characters in the string by space and i want the total count of the string excluding the spaces.

For example if a string contains 18 characters and i have passed only 10 characters and now i want the total length as 10 only.

Please mail to me at emadduri@gmail.com

Thanks & Regards,

MLN.

4 REPLIES 4
Read only

Laxmana_Appana_
Active Contributor
0 Likes
518

Hi,

if your string contains # as invalid character.(repeate same process for all invalid characters) use REPLACE to remove this character. after replacing with space use CONDENSE to remove spaces.now use STRLEN to get length of the string.

ex:

REPLACE ALL OCCURRENCES OF '#' IN string1 WITH space.

condense string1 with no-gaps.

x_length = strlen(string1).

Regards

Appana

*Reward Points for useful answers

Read only

Former Member
0 Likes
518

first

replace the unwanted characters in the string

for this,

USE REPLACE command

and to shrink the string with leading/trailing spaces

use

CONDENSE V_STRING NO-GAPS.

THEN use STRLEN to calculate the length

v_integer = strlen( v_string ).

regards

srikanth

Read only

Former Member
0 Likes
518

Hi narayana,

data: str1,str2 type string.

data: len1 type i.

replace all occurences of 'A' in str1 with space.

str2 = str1.

condense str2 no-gaps.

len1 = strlen (str2).

hope this helps u.

regards,

keerthi.

Read only

Former Member
0 Likes
518

hi,

u can check the below links

if u find it useful plz mark the points

Regards,

Naveen