Solved

VFP 9 Insert a "-" after the 3rd Char

Posted on 2014-10-20
2
201 Views
Last Modified: 2014-10-20
We are using VFP 9 and I would like to add a "-" after the 3rd Char
eg

hold
1185264
1259632
4582565

change to

hold
118-5264
125-9632
458-2565

Thanks
0
Comment
Question by:RVL
2 Comments
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 40392414
You should be able to use SUBSTR() function - something like:

SUBSTR(1185264, 1,3)+'-'+SUBSTR(1185264,4,4)


http://msdn.microsoft.com/en-us/library/5464bfxy(v=vs.80).aspx
0
 
LVL 32

Expert Comment

by:awking00
ID: 40392537
Note - if there can be fewer or a greater number of characters than four after the third character, just elminate the last parameter of the substr function which defaults to the end of the string -
SUBSTR(yourfield, 1,3) + '-' + SUBSTR(yourfield,4)
No points, please.
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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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

18 Experts available now in Live!

Get 1:1 Help Now