Subject |
Re: insert dash after N characters in a strings |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Tue, 26 May 2015 05:15:35 +0200 |
Newsgroups |
dbase.getting-started |
On Tue, 26 May 2015 04:30:42 +0200, kent <gkent_28@yahoo.com> wrote:
> On the first example 999-999-999-000:
> this is on a separate entry field , on this field I want it in such a
> way that every 3 character there's a 'DASH' , and on the end 3 zeros
> will be automatically added.
>
>
> on the 2nd example 9-99W-WXX-44E:
> this is also on the separate field. the difference is that the dashes
> are located differently and no additional zeros are added after the
> values.
>
>
> sorry guys for not clearing this out.
>
> Thanks in advance.
this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
onLostFocus = class::ENTRYFIELD1_ONLOSTFOCUS
height = 1.0
left = 8.8571
top = 3.3182
width = 16.0
picture = "xxx-xxx-xxx-000"
function = "!R"
value = " "
endwith
this.ENTRYFIELD2 = new ENTRYFIELD(this)
with (this.ENTRYFIELD2)
height = 1.0
left = 8.8571
top = 6.9091
width = 13.7143
picture = "x-xxx-xxx-xxx"
function = "!R"
value = " "
endwith
The x in the picture property will accept both numbers and characters. If
you want specific positions to be numbers use a 9 instead of the relevant
x in the picture.
The ! in the function property forces characters to uppercase.
If you save the values to a field only the actual input will be saved eg
999999999 and 999WWXX44E for your two examples.
Mervyn.
|
|