Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transform()
Message
 
 
To
19/12/2016 01:08:20
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01645510
Message ID:
01645528
Views:
35
>>Hi,
>>
>>I have a code in the program that converts a string of numbers (not a number but a string of numbers) according to the second parameter of Transform(). For example,
>>
>>nNumber = 67849
>>cMask = 'M XXXXXXXXXX'
>>cNumber = transform( alltrim(str(nNumber)) + "@R" + cMask)
>>*-- the result, cNumber, should be 'M 67849'
>>
>>
>>The above works unless the cMask is 'A XXXXXXXXXX'
>>
>>Why does the 'A' make a difference?
>>
>>TIA
>
>I presume you've made a few typos in your example:
>
cNumber = transform( alltrim(str(nNumber)), "@R " + cMask)
>(i.e. you probably wanted to have: 1. a comma rather than a "+" between the expression and the format code; 2. a space between the "@R" and character mask)
>
>IIRC in the case when the first parameter to TRANSFORM() is a string value, "A" in a mask would be the equivalent to "X" -- thus variable cNumber would contain the value "6 7849" rather than "A 6789"

Hi Naoto,
You are correct that I made some typos in my post and absolutely correctly described the typos. Sorry.
You, also, correctly described what happens when the cMask value has "A" as the first character.
Do I understand that in order for me to transfer the numbers "67849" and the mast "A XXXXXXXXX" into "A 67849" I need to do away with using "@R " and have a different approach? Like parsing the cMask?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform