|
-
Oct 23rd, 2007, 02:43 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] Removing a number variable of spaces at the start of a string
Hi!!!
I want to remove in a string any spaces in the begining of the string, but the string can have a variable spaces at the start and also HAS spaces in the middle and in the end. So i just want to remove the "start spaces" not the other ones and these "start spaces" can be diferent. Sometimes can only be 2 spaces and sometimes can be 5 spaces. U get the pic.
-
Oct 23rd, 2007, 02:51 PM
#2
Re: [2005] Removing a number variable of spaces at the start of a string
Code:
Dim MyString as String = " HELLO WORLD"
MyString = MyString.TrimStart
Messagebox.Show(MyString)
-
Oct 23rd, 2007, 02:51 PM
#3
Re: [2005] Removing a number variable of spaces at the start of a string
Look at the Trim function and see if it will do what you want. I believe there is a variant to Trim from front, back, or both. If that is not sufficient, then you might have to walk along the string removing spaces, but Trim should suffice.
My usual boring signature: Nothing
 
-
Oct 24th, 2007, 07:30 AM
#4
Thread Starter
Fanatic Member
Re: [2005] Removing a number variable of spaces at the start of a string
Thks a lot!!! I didnt use that function earlier because it says:
"Removes all occurrences of a set of characters specified in a array from the beginning of this instance" and it has a Parameter and no overloads. So i fought it couldn't be used without any parameters.
-
Oct 24th, 2007, 08:31 AM
#5
Re: [RESOLVED] [2005] Removing a number variable of spaces at the start of a string
true, but if you look at the return value section of the MSDN doc for this function it states:
The string that remains after all occurrences of characters in the trimChars parameter are removed from the start of the current String object. If trimChars is a null reference (Nothing in Visual Basic), white-space characters are removed instead.
-
Oct 24th, 2007, 01:35 PM
#6
Thread Starter
Fanatic Member
Re: [RESOLVED] [2005] Removing a number variable of spaces at the start of a string
lol. Looks like i have to read more in order to get more info. Because if i've read that i woudnt ask in the first place, lool
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
|