A regular expression would work out much better for this. Look for a single character at the end, if found, reReplace() to a new variable using a backreference to duplicate whatever letter is there already. I'd write the code for you but I'm too busy at the moment. If Jochem is around he can do it faster than me anyway ;)
-Justin > -----Original Message----- > From: Adrian Lynch [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 18, 2005 2:42 PM > To: CF-Talk > Subject: RE: Anyone know of a more elegant way to do this? > > You could use Chr(65) though to Chr(90), this will give you A > through to Z. > > Chr() and Asc() together might give you something better. > > Ade > > -----Original Message----- > From: SStewart [mailto:[EMAIL PROTECTED] > Sent: 18 May 2005 19:34 > To: CF-Talk > Subject: Anyone know of a more elegant way to do this? > > > I'm incrementing a project number, it's an alpha-numeric > "number" (001000A > or 001000AA) if it's a new project I just grab the first six > numbers and > increment, if it's an extended project I have to increment > the letter with > the next one. > > My code works but it's kind of a battering ram approach, is > there a more > elegant way to do this? > > Thanks > > sas > > <cfif Right(qry_getLastPnum.lPnum,2) CONTAINS "A"> > <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"B"> > <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "B"> > <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"C"> > <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "c"> > <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"D"> > <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "D"> > <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"E"> > <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "E"> > <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"F"> > > Scott A. Stewart, > Web Application Developer > > Engineering Consulting Services, Ltd. (ECS) > 14026 Thunderbolt Place, Suite 300 > Chantilly, VA 20151 > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: > 17/05/2005 > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207067 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

