Adding SN infront of

ehart12
ehart12 used Ask the Experts™
on
Hi _agx_ or other Expert,

I just started using the below code from previous post this morning and would now like to add SN in front of each number as follows;

Current display: 001-003,005-010,012-015,017,019,021,026-028

Desired display: SN001-SN003,SN005-SN010,SN012-SN015,SN017,SN019,SN021,SN026-SN028

<cfif startAt lt pos>
   <!--- range --->
   <cfset fromValue = NumberFormat( numbers[startAt] , "000")>
   <cfset toValue = NumberFormat( numbers[pos] , "000")>
   <cfset arrayAppend(ranges, fromValue  &"-"& toValue )>
<cfelse>
   <!--- single value --->
   <cfset arrayAppend(ranges,  NumberFormat(numbers[pos], "000"))>
</cfif>

Thank you,

Eric
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Commented:
You can just prepend it to the front with "&" 

<cfif startAt lt pos>
   <!--- range --->
   <cfset fromValue = "SN"& NumberFormat( numbers[startAt] , "000")>
   <cfset toValue = "SN"& NumberFormat( numbers[pos] , "000")>
   <cfset arrayAppend(ranges, fromValue  &"-"& toValue )>
<cfelse>
   <!--- single value --->
   <cfset arrayAppend(ranges,  "SN"& NumberFormat(numbers[pos], "000"))>
</cfif>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial