Remove x number of charaters from string. Vb.net

  • Thread starter Thread starter Jason
  • Start date Start date
J

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.
 
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.
 
Thanks, thats what I'm looking for, and I've accounted for the exception.


Marina Levit said:
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 said:
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.
 
I would recommend using the EndsWith method of the string instance you are
checking against :)

hth,
Mythran


Jason said:
Thanks, thats what I'm looking for, and I've accounted for the exception.


Marina Levit said:
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 said:
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.
 
Back
Top