Home All Groups Group Topic Archive Search About

Remove x number of charaters from string. Vb.net

Author
22 Aug 2006 4:01 PM
Jason
If I've got a string like x = "[00000014] Intel(R) PRO/1000 CT Network
Connection"


How do I get x = "Intel(R) PRO/1000 CT Network Connection"

I basically want to make a comparison to Intel(R) PRO/1000 CT Network
Connection, since the numeric part seems to change per system.

Author
22 Aug 2006 4:05 PM
Marina Levit [MVP]
Are you asking how to remove some static number of characters from the front
of a string?

In that case something like:

str = str.Substring(7)

Will return characters 8-n, where n is the total number. Of course, if you
have less 8 characters in the string to begin with, this would cause an
exception - so you have to check for that.

Show quoteHide quote
"Jason" <some***@microsoft.com> wrote in message
news:OXs2qQgxGHA.2260@TK2MSFTNGP03.phx.gbl...
> If I've got a string like x = "[00000014] Intel(R) PRO/1000 CT Network
> Connection"
>
>
> How do I get x = "Intel(R) PRO/1000 CT Network Connection"
>
> I basically want to make a comparison to Intel(R) PRO/1000 CT Network
> Connection, since the numeric part seems to change per system.
>
Author
22 Aug 2006 4:51 PM
Jason
Thanks, thats what I'm looking for, and I've accounted for the exception.


Show quoteHide quote
"Marina Levit [MVP]" <someone@nospam.com> wrote in message
news:ew5uSTgxGHA.4576@TK2MSFTNGP03.phx.gbl...
> Are you asking how to remove some static number of characters from the
> front of a string?
>
> In that case something like:
>
> str = str.Substring(7)
>
> Will return characters 8-n, where n is the total number. Of course, if you
> have less 8 characters in the string to begin with, this would cause an
> exception - so you have to check for that.
>
> "Jason" <some***@microsoft.com> wrote in message
> news:OXs2qQgxGHA.2260@TK2MSFTNGP03.phx.gbl...
>> If I've got a string like x = "[00000014] Intel(R) PRO/1000 CT Network
>> Connection"
>>
>>
>> How do I get x = "Intel(R) PRO/1000 CT Network Connection"
>>
>> I basically want to make a comparison to Intel(R) PRO/1000 CT Network
>> Connection, since the numeric part seems to change per system.
>>
>
>
Author
22 Aug 2006 5:15 PM
Mythran
I would recommend using the EndsWith method of the string instance you are
checking against :)

hth,
Mythran


Show quoteHide quote
"Jason" <some***@microsoft.com> wrote in message
news:uuuaHtgxGHA.4968@TK2MSFTNGP03.phx.gbl...
> Thanks, thats what I'm looking for, and I've accounted for the exception.
>
>
> "Marina Levit [MVP]" <someone@nospam.com> wrote in message
> news:ew5uSTgxGHA.4576@TK2MSFTNGP03.phx.gbl...
>> Are you asking how to remove some static number of characters from the
>> front of a string?
>>
>> In that case something like:
>>
>> str = str.Substring(7)
>>
>> Will return characters 8-n, where n is the total number. Of course, if
>> you have less 8 characters in the string to begin with, this would cause
>> an exception - so you have to check for that.
>>
>> "Jason" <some***@microsoft.com> wrote in message
>> news:OXs2qQgxGHA.2260@TK2MSFTNGP03.phx.gbl...
>>> If I've got a string like x = "[00000014] Intel(R) PRO/1000 CT Network
>>> Connection"
>>>
>>>
>>> How do I get x = "Intel(R) PRO/1000 CT Network Connection"
>>>
>>> I basically want to make a comparison to Intel(R) PRO/1000 CT Network
>>> Connection, since the numeric part seems to change per system.
>>>
>>
>>
>
>