|
-
May 12th, 2011, 06:41 PM
#1
Thread Starter
Addicted Member
how would i remove right most spaces from a string?
Okay, lets say I had a string variable that contained "Hello World! ", (or whatever the string contained)
how would i remove the the right most spaces to make it say "Hello World"
(im reading in items from a text file using substrings that has fixed positions with one line of the text containing several different items)
or does it automatically eliminate the right most spaces???
-
May 12th, 2011, 06:45 PM
#2
Re: how would i remove right most spaces from a string?
A String object has a TrimLeft method that removes leading characters, a TrimRight method that removes trailing characters and a Trim method that does both. You can specify the character(s) to trim or not, in which case spaces are assumed.
-
May 12th, 2011, 06:46 PM
#3
Thread Starter
Addicted Member
Re: how would i remove right most spaces from a string?
it doesn't automatically delete the space(s) i just tested
-
May 12th, 2011, 06:46 PM
#4
Thread Starter
Addicted Member
Re: how would i remove right most spaces from a string?
you sure do save me a lot of time...hahaha
-
May 12th, 2011, 06:49 PM
#5
Thread Starter
Addicted Member
Re: how would i remove right most spaces from a string?
also, another quick question i have for you if you know the answer...
Lets say I have a string that contained "Monday"
would it be possible to find out when the next Monday would occur?
-
May 12th, 2011, 07:07 PM
#6
Re: how would i remove right most spaces from a string?
 Originally Posted by StevenA
you sure do save me a lot of time...hahaha 
I take it that that means that you worked out that it doesn't remove spaces from the original String but, like all String manipulation functions, returns a new String containing the changes.
-
May 12th, 2011, 07:08 PM
#7
Re: how would i remove right most spaces from a string?
 Originally Posted by StevenA
also, another quick question i have for you if you know the answer...
Lets say I have a string that contained "Monday"
would it be possible to find out when the next Monday would occur?
That's nothing to do with the topic of this thread. Please keep each thread to a single topic and each topic to a single thread. If you want to address a new topic then please create a new thread, with a title that indicates that topic.
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
|