Solved

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

Posted on 2014-10-20
2
202 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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…

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