Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trunc alphabets portion from string

Status
Not open for further replies.

pkohli88

Programmer
Oct 25, 2006
30
US
I have column that has follwing values
Code:
e.g 
rsh 102.33.45
login 103.44.55
AGIY 123.4.66
JIG PI 23.45.666

in result i want only show only part of string before numeric

example
Code:
rsh
login
AGIY
JIG PI

Is it possible with crystal Report 10

Thanks

 
Use a formula:

whileprintingrecords;
stringvarMyField:={table.field};
Stringvar Output;
numbervar x;
for x:= 1 to len(MyField) do(
if not(isnumeric(mid(MyField,x,1))) then
Output:=Output & mid(MyField,x,1)
);
Output

-k
 
Thanks
This formula works fine. Only thing is along with string severval "." are also attached
for eg rsh ...

how can i exit loop as soon as it finds a numeric value..

Thanks
 
Try:

whileprintingrecords;
stringvarMyField:={table.field};
Stringvar Output;
numbervar x;
for x:= 1 to len(MyField) do(
if not(isnumeric(mid(MyField,x,1)))
and
mid(MyField,x,1) <> "."
then
Output:=Output & mid(MyField,x,1)
);
Output

-k
 
Hi,
I have noticed that there are couple of entries that also have other charcters behind the numeric field

e.g rsh 102.45.67 , due to IOP

and in result i am getting

rsh , due to IOP

how can ignore those...

I tried using Exit while but its not working

Thanks




 
Ahhh, the creeping requirement...

I could rework, but just use:

whileprintingrecords;
stringvarMyField:={table.field};
Stringvar Output;
numbervar x;
for x:= 1 to len(MyField) do(
if not(isnumeric(mid(MyField,x,1)))
and
not(mid(MyField,x,1) in [".",","])
then
Output:=Output & mid(MyField,x,1)
);
trim(Output)

Add whatever you need to in [".",","]

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top