Solved

Insert hyphen INTO MY STRING

Posted on 2012-03-16
2
226 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
Comment Utility
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
Comment Utility
Thank you
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Syntax Help on SP 4 52
Classic ASP - x-editable save to SQL 3 62
Adding Datediff to staistics page 2 33
Copy only dates 3 69
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now