Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Insert hyphen INTO MY STRING

Posted on 2012-03-16
2
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
nap0leon earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

604 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