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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trim number field 4

Status
Not open for further replies.

needmoremoney

Technical User
Mar 30, 2005
123
US
I have a field called phonenumber.

(209)234-2343

I need to trim this to just the area code. Any help thanks.

209

I'm using crystal 8.5
 
If you always have a leading parenthesis, you can do this in a formula:

{table.field}[2 to 4]

or to be safe, you add the replace function in there:

replace({table.field},"(",""),[1 to 3]

~Brian
 
Does the field always have round brackets around the area code?
If so, try this

Split( Replace( {Table.Field} , "(" ,""), ")" )[1]


Bob Suruncle
 
Hello Bob, the statement that you gave works great! Thanks much.

By the way, I could you explain to me how it works?
 
Brian's first solution would work and his second one (*)would have worked perfectly, too, but for an extra comma.

replace({table.field},"(","")[1 to 3]

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top