|
-
Feb 15th, 2000, 11:55 PM
#1
Thread Starter
New Member
How do you Create your own user-defined string formats.
I need to take string variable of x number of characters and pad with spaces so its length is always 25 characters. I would like to use a Format command and according to the Help file I can use the "@" symbol to represent a character placeholder, but it wont work.
-
Feb 16th, 2000, 01:06 AM
#2
Thread Starter
New Member
Thanks for the reply, but not quite what I'm after.
What I am trying to do is:
A$="abcdefghijkl" 'Test input string
B$=format (A$,"!@@@@@") ' Keep first five characters and discard remaining.
debug.print B$ 'Print result
Maybe I need to just read 5 characters fron left side then fill remaining 15 character positions with spaces.
Any sugestions?
Originally posted by Buzby:
If you define the string fixed length;
eg
Dim MyString As String * 25
it will always be 25 characters long (padded with spaces).
The Format command should work
eg;
format("hello","!@@@@@@@@@@")
would return "hello" followed by 5 spaces - if you leave the ! out it would return 5 spaces followed by "hello".
Does this help?
-
Feb 16th, 2000, 01:11 AM
#3
Left$(A, 5) will give "abcde"
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
-
Feb 16th, 2000, 12:03 PM
#4
Frenzied Member
If you define the string fixed length;
eg
Dim MyString As String * 25
it will always be 25 characters long (padded with spaces).
The Format command should work
eg;
format("hello","!@@@@@@@@@@")
would return "hello" followed by 5 spaces - if you leave the ! out it would return 5 spaces followed by "hello".
Does this help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|