Take a look at the mid function. The syntax is <cfset rs = mid(string, start, count)>
So you could do something like this... <cfset agentNumber = '123456789123'> <cfset master = mid(agentNumber, 1, 4)> <cfset region = mid(agentNumber, 4, 4)> and so on. jon ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Wednesday, February 13, 2002 6:17 PM Subject: Re: How do you get middle 4 numbers out of agent code number > This code below works great, but how bout if you wanted the second set of 4 > numbers from the left. > > i.e. Lets say someone provides an agent number of ' > > 123456789123' and it needs to be split into 3 parts with 4 charcters each: > > Master=1234 > Region=5678 > Agent=9123 > > Because there is a signup process where a 12 digit number needs to be broken > down into 3 pieces. > > Thanks. > > > > > Can't you just use left and right? > > > > Like: > > > > <cfset FORM.ccnumber = trim(FORM.ccnumber)> > > > > <cfset leftnumbers = left(FORM.ccnumber, len(FORM.ccnumber) - 4)> > > <cfset rightnumbers = right(FORM.ccnumber, 4)> > > > > ______________________ > > steve oliver > > atnet solutions, inc. > > http://www.atnetsolutions.com > > > > > > -----Original Message----- > > From: Jeff Fongemie [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, February 13, 2002 5:14 PM > > To: CF-Talk > > Subject: Split up a credit card number? Need regex handout! > > > > > > Hello everyone, > > > > I need to take a given form field (numbers) and break it into 2 > > parts. Then insert one part, and cfmail the other. The number can > > be different lengths. > > > > For example: 3939 4444 4444 2222 may get passed by a form field. > > > > I need to insert the 3939 4444 4444 to a DB, and cfmail the 2222. > > > > I must admit that I'm stuck on this one, I can't even get a good > > working start. I can take the number and replace the first 4 > > digits with nothing, which will give me the second half. > > > > But then how to get the first 4 digits? > > > > Am I going about this the wrong way? Is there a better approach? > > > > > > > > > > > > > > Best regards, > > Jeff Fongemie mailto:[EMAIL PROTECTED] > > > > > > _____________________________________________________ > > Composed on Wednesday, February 13, 2002, at 4:58:30 PM > > > > > ______________________________________________________________________ Why Share? Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

