Solved

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

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now