|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Remove x number of charaters from string. Vb.netIf 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. 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. > 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. >> > > 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. >>> >> >> > >
Conversion
DLL created in .NET cannot use? (Inno Setup) Drawing images in different shapes VB.Net problem in converting to C# Catch reference error how? Getting error LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in atlmincr database connection Change code in Debug mode table structure - wrong columns being called Intellisense for component |
|||||||||||||||||||||||