|
-
Jan 6th, 2009, 07:56 PM
#1
Thread Starter
Addicted Member
String Behavior
Hi Guys,
I was wondering is there a way I could do the following. I want to display a string as follows.

I want the info to be surrounded by a neat box a little like something you would see in notepad. The issue is that the values x,y and z will all change in length as they will be dynamic. Is there a way to ensure that the right "|" sides dont move? Just so I can have a nice neat right hand side.
I have vague memories of doing something similar in java to do with tab? Could have imagined it.
All help is appreciated.
Cheers People
BB
Last edited by billyblue; Jan 6th, 2009 at 07:59 PM.
-
Jan 6th, 2009, 08:04 PM
#2
Re: String Behavior
Convert x, y and z to Strings if they aren't already and then call PadRight to add as many spaces as are needed to create a String of a specific length. If you call PadRight(20) then the result will always be 20 characters long. If the initial string was 10 characters long then 10 spaces would be added. If the original length was 15 then 5 spaces would be added, etc.
-
Jan 6th, 2009, 08:16 PM
#3
Thread Starter
Addicted Member
Re: String Behavior
 Originally Posted by jmcilhinney
Convert x, y and z to Strings if they aren't already and then call PadRight to add as many spaces as are needed to create a String of a specific length. If you call PadRight(20) then the result will always be 20 characters long. If the initial string was 10 characters long then 10 spaces would be added. If the original length was 15 then 5 spaces would be added, etc.
Fantastic. Thanks jmc. I will give that a go after I get some sleep
Cheers
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
|