Solved

Insert hyphen INTO MY STRING

Posted on 2012-03-16
2
227 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic? Dropdown Box 29 71
Out the count variables 6 53
UTC (timezone) without using an API 16 40
API works for 1 result, need to make it many 30 67
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…
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/…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

895 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

15 Experts available now in Live!

Get 1:1 Help Now