Gil,
This little DO WHILE loop will do it. Perhaps there is a better way?
---------------------------
/* Author: Troy Funte
Date: 7/18/03 */
/* begin program to remove spaces from a string*/
DEFINE VARIABLE File_Name AS CHAR.
DEFINE VARIABLE i AS INTEGER INIT 0.
DEFINE VARIABLE j AS INTEGER INIT 0.
DEFINE VARIABLE k AS INTEGER INIT 0.
DEFINE VARIABLE Sentence AS CHAR FORMAT "X(8)".
/* read this text file to view the output string */
File_Name = "c:\documents and settings\administrator\desktop\test.txt".
output to VALUE(File_Name).
Sentence = " Is this the way to remove spaces ? ".
/* The TRIM function removes leading and ending spaces. */
Sentence = TRIM(Sentence).
/* DO WHILE loop to remove each space, one at a time. */
/* INDEX(string,substring) returns a 0 if the string does not contain the
substring " " */
DO WHILE INDEX(sentence," ") <> 0:
i = INDEX(sentence," "). /* i is the position of the first space in the
string */
j = i + 1. /* j is the position after the space */
k = i - 1. /* k is the position before the space */
/* The following line will remove one space */
Sentence = SUBSTRING(Sentence,1,k) + SUBSTRING(Sentence,j,length(Sentence)).
END.
EXPORT Sentence.
OUTPUT CLOSE.
---------------------------------------
Troy Funte
Liberty Electronics
-----Original Message-----
From: Gil Amilbangsa [mailto:gil.amilbangsa@...]
Sent: Thursday, July 17, 2003 9:57 PM
To: Vantage Users Group (E-mail)
Subject: [Vantage] HOW DO YOU REMOVE SPACES IN A STRING IN PROGRESS?
Hi all,
Is it possible to remove all spaces between words in a string in Progress?
How is it done?
Any replies appreciated.
Cheers fro down under,
Gil Amilbangsa
Australian Healthcare Equipment - Murphy Furniture
gil.amilbangsa@...
Yahoo! Groups Sponsor
ADVERTISEMENT
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
This little DO WHILE loop will do it. Perhaps there is a better way?
---------------------------
/* Author: Troy Funte
Date: 7/18/03 */
/* begin program to remove spaces from a string*/
DEFINE VARIABLE File_Name AS CHAR.
DEFINE VARIABLE i AS INTEGER INIT 0.
DEFINE VARIABLE j AS INTEGER INIT 0.
DEFINE VARIABLE k AS INTEGER INIT 0.
DEFINE VARIABLE Sentence AS CHAR FORMAT "X(8)".
/* read this text file to view the output string */
File_Name = "c:\documents and settings\administrator\desktop\test.txt".
output to VALUE(File_Name).
Sentence = " Is this the way to remove spaces ? ".
/* The TRIM function removes leading and ending spaces. */
Sentence = TRIM(Sentence).
/* DO WHILE loop to remove each space, one at a time. */
/* INDEX(string,substring) returns a 0 if the string does not contain the
substring " " */
DO WHILE INDEX(sentence," ") <> 0:
i = INDEX(sentence," "). /* i is the position of the first space in the
string */
j = i + 1. /* j is the position after the space */
k = i - 1. /* k is the position before the space */
/* The following line will remove one space */
Sentence = SUBSTRING(Sentence,1,k) + SUBSTRING(Sentence,j,length(Sentence)).
END.
EXPORT Sentence.
OUTPUT CLOSE.
---------------------------------------
Troy Funte
Liberty Electronics
-----Original Message-----
From: Gil Amilbangsa [mailto:gil.amilbangsa@...]
Sent: Thursday, July 17, 2003 9:57 PM
To: Vantage Users Group (E-mail)
Subject: [Vantage] HOW DO YOU REMOVE SPACES IN A STRING IN PROGRESS?
Hi all,
Is it possible to remove all spaces between words in a string in Progress?
How is it done?
Any replies appreciated.
Cheers fro down under,
Gil Amilbangsa
Australian Healthcare Equipment - Murphy Furniture
gil.amilbangsa@...
Yahoo! Groups Sponsor
ADVERTISEMENT
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.