Solved

Insert hyphen INTO MY STRING

Posted on 2012-03-16
2
228 Views
Last Modified: 2012-03-21
hi,

I have a string with

 "NLU97PF0LO0Q6ZHL0IZZHIZAXALYLD6RU"

but what I want is this

NLU97PF0-LO0Q-6ZHL-0IZZ-HIZAXALYLD6RU

with hyphen

thanks,
0
Comment
Question by:lulu50
2 Comments
 
LVL 18

Accepted Solution

by:
nap0leon earned 500 total points
ID: 37731183
This ought to give you a feel for how to do it.

<%
str = "NLU97PF0LO0Q6ZHL0IZZHIZAXALYLD6RU"
desired = "NLU97PF0-LO0Q-6ZHL-0IZZ-HIZAXALYLD6RU"
position1 = 8
position2 = 12
position3 = 16
position4 = 20

newStr = Left(str,position1) & "-" & Mid(str,position1+1,4) & "-" & Mid(str,position2+1,4) & "-" & Mid(str,position3+1,4) & "-" & Mid(str,position4+1)

response.write(desired & "<br/>")
response.write(newStr)

%>

Open in new window

0
 

Author Closing Comment

by:lulu50
ID: 37746819
Thank you
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question