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

String Functions

Former Member
0 Likes
786

Hi,

How to remove a space in a string ?

st = ' hai'.

I want to remove front and back spaces .

If there any function ?

Bye,

Satya.

6 REPLIES 6
Read only

Former Member
0 Likes
761

Hi

use CONDENSE command

condence str.

will remove the spaces

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
761

use <b>condense</b>

Read only

Former Member
0 Likes
761

Hi,

Try this code,

SHIFT st RIGHT DELETING TRAILING SPACE

Thanks.

Reward If Helpful.

Read only

Former Member
0 Likes
761

Hi,

The CONDENSE statement deletes redundant spaces from a string:

CONDENSE <c> [NO-GAPS].

This statement removes any leading blanks in the field <c> and replaces other sequences of

blanks by exactly one blank. The result is a left-justified sequence of words, each separated by

one blank. If the addition NO-GAPS is specified, all blanks are removed.

DATA: STRING(25) VALUE ' one two three four',

LEN TYPE I.

LEN = STRLEN( STRING ).

WRITE: STRING, '!'.

WRITE: / 'Length: ', LEN.

CONDENSE STRING.

LEN = STRLEN( STRING ).

WRITE: STRING, '!'.

WRITE: / 'Length: ', LEN.

CONDENSE STRING NO-GAPS.

LEN = STRLEN( STRING ).

WRITE: STRING, '!'.

WRITE: / 'Length: ', LEN.

Output:

one two three four !

Length: 25

one two three four !

Length: 18

onetwothreefour !

Length: 15

Note that the total length of the field STRING remains unchanged, but that the

deleted blanks appear again on the right.

Regards,

Bhaskar

Read only

0 Likes
761

Hi ,

My problem is We are taking values from java program . They are sending in String Format for the Quantity field. We have to take the values and we have to update in our database. In our database quntatiy field is with packed decimal with 3 digits in after decimals.

How we can convert it ?

Bye,

Satya.

Read only

Former Member
0 Likes
761

CONDENSE <string name> NO-GAPS.