Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula to removing all alpha chars in string Post Reply Post New Topic
Author Message
corc22
Newbie
Newbie


Joined: 02 Dec 2010
Online Status: Offline
Posts: 2
Quote corc22 Replybullet Topic: Formula to removing all alpha chars in string
     Posted: 02 Dec 2010 at 10:16pm
Hi all
 
I need to remove all alpha characters in a string, the strings can be different lengths for example xx02134540564 (the xx will need to be removed), or xyzaba012345 ( the xyzabc needs to be removed)
 
Is the a formula that can strip all alpha chars?
 
Thanks in advance
 
Rob
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Dec 2010 at 3:56am
No, there isn't, you would need to create one.
If the characters will never be mixed ie x0s9g2485j2, I would create a formula the loops through the string until it passes the IsNumberic() function. Something like:
 
local numbervar iCount :=1;
while not isnumeric(mid({table.field}, iCount)) do
( iCount := iCount + 1);
 
mid({table.field}, iCount)
 
HTH
IP IP Logged
corc22
Newbie
Newbie


Joined: 02 Dec 2010
Online Status: Offline
Posts: 2
Quote corc22 Replybullet Posted: 03 Dec 2010 at 4:01am

Worked a charm!!!

Many Thanks

Rob

 

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum