D
dchman
I am trying to use the format function to right-pad strings.
For instance, i have a string x that must have a length of 365 characters
(to match a custom data type). After a user enters a value for x (which may
not be 365 characters), i have to convert it to a string with a length of 365.
Here is an example:
dim t as string, sNew as string, s as string
's is obtained from a text box -
s="SELECT GPDate, GPTitle, GPCo FROM tblGPType Where GPType = 4 And GPCo =
Question('CoGrp') ORDER BY GPActDate DESC;"
t="!" & string(365,"@") 'creates a format template
sNew = format(s,t)
I expect sNew to be the same as s padded to the right with spaces to a
length of 365. However, what is returned is
"T GPDate, GPTitle, GPCo FROM tblGPType Where GPType = 4 And GPCo =
Question('CoGrp') ORDER BY GPActDate DESC; ........"
It has a length of 365, but several of the initial characters from the s
have been truncated.
I can't find any documentation that would explain this behaviour, but it
sure is giving me a headache.
Any one have an idea as to what is going on?
thanks
For instance, i have a string x that must have a length of 365 characters
(to match a custom data type). After a user enters a value for x (which may
not be 365 characters), i have to convert it to a string with a length of 365.
Here is an example:
dim t as string, sNew as string, s as string
's is obtained from a text box -
s="SELECT GPDate, GPTitle, GPCo FROM tblGPType Where GPType = 4 And GPCo =
Question('CoGrp') ORDER BY GPActDate DESC;"
t="!" & string(365,"@") 'creates a format template
sNew = format(s,t)
I expect sNew to be the same as s padded to the right with spaces to a
length of 365. However, what is returned is
"T GPDate, GPTitle, GPCo FROM tblGPType Where GPType = 4 And GPCo =
Question('CoGrp') ORDER BY GPActDate DESC; ........"
It has a length of 365, but several of the initial characters from the s
have been truncated.
I can't find any documentation that would explain this behaviour, but it
sure is giving me a headache.
Any one have an idea as to what is going on?
thanks