-
I have couple data want to save it into a txt file, but it's very hard to aligh it, because the length of data are different, so I am thinking if I can fix the length of them, it will be much easier to format my txt file.
like fix length to 10:
"John" will become "John "
add space to it.
is there any function can do this?
or do you have better sugestions?
Thanks
Cerebrate
-
Look up the Trim property in VB Help
-
not trim...
it's fixed length strings.
Type Record
strName as string * 10
End Type
'all records in strname will take 10 spaces
'all records saved will occupy 10 spaces
I haven't realy played with this..just once in
school...for fixed lenght I use an Access Data Base
hope it helps you in some way.
-
Fixed-lengths strings are a good choice. Alternatively, you could use the Format$ function, like this:
strField = Format$("whatever", "!@@@@@@@@@@")
In the Format$ function, "at" signs (@) will normally right-justify an item in a field of that many positions (i.e., 10 @ signs = 10-position output area). By placing an exclamation point (!) in front of the @ signs, you force the data to be left-justified.
-
use the str$(length, character) function.