For Programmers: Free Programming Magazines  


Home > Archive > Clarion > March 2006 > REMOVING SPACE IN THE MIDDLE OF A STRING









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author REMOVING SPACE IN THE MIDDLE OF A STRING
Faron@DiamondSoftwareSystems.com

2006-03-05, 6:55 pm

I am having to write a utility to remove a space in a string that was
created by clipping a String and a Long together with incorrect
formatting.
There is about 10,000 records to do, so doing it manually is out of the
question for them.

I clipped a String and Long together formatting the Long as (@N5) when
it
should have been (@N_5). When the Long was 4 or 5 chars, the comma
created a
space.

Format I used:
KEL:KeySymbol = Clip(KEL:SymbolOne) & FORMAT(KEL:SymbolNum,@N5)

AAD1 001 Should be AAD1001
SSMK2 421 Should be SSMK2410

How can I run a process to remove the space in the String
(KEL:KeySymbol)

TIA

Faron

Ian Holdsworth

2006-03-06, 7:55 am

Faron

I'm assuming that you just want to remove the character and not replace
it.

This is from memory so you may have to fiddle with it ;)

loop idx#=1 to len(clip(KEL:KeySymbol))
if sub(KEL:KeySymbol,idx#,1)=' '

KEL:KeySymbol=left(KEL:KeySymbol,idx#-1)& sub(KEL:KeySymbol,idx#+1,size(KEL:KeySym
bol))
idx#-=1
end
end

Note some of the lines may have wrapped.

HTH

Faron@DiamondSoftwareSystems.com wrote:
> I am having to write a utility to remove a space in a string that was
> created by clipping a String and a Long together with incorrect
> formatting.
> There is about 10,000 records to do, so doing it manually is out of the
> question for them.
>
> I clipped a String and Long together formatting the Long as (@N5) when
> it
> should have been (@N_5). When the Long was 4 or 5 chars, the comma
> created a
> space.
>
> Format I used:
> KEL:KeySymbol = Clip(KEL:SymbolOne) & FORMAT(KEL:SymbolNum,@N5)
>
> AAD1 001 Should be AAD1001
> SSMK2 421 Should be SSMK2410
>
> How can I run a process to remove the space in the String
> (KEL:KeySymbol)
>
> TIA
>
> Faron


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com