|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Test for integerI have a 3 character string that I want to test to see if it is a positive
integer... I could test that each individual character is >=0 and <=9... is there a better way ? Is there an IsInteger() function ? "Rob" <rwch***@comcast.net> schrieb: If you are using .NET 2.0, you may want to use 'Integer.TryParse'. In .NET >I have a 3 character string that I want to test to see if it is a positive >integer... I could test that each individual character is >=0 and <=9... is >there a better way ? 1.0/1.1 you can use 'Integer.Parse' + exception handling. Maybe using 'IsNumeric' is an option too. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Show quote
Hide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message Hmm, I have wondered for a long while why they didn't make a TryParse for news:ubxVQXxEGHA.1396@TK2MSFTNGP11.phx.gbl... > "Rob" <rwch***@comcast.net> schrieb: >>I have a 3 character string that I want to test to see if it is a positive >>integer... I could test that each individual character is >=0 and <=9... >>is there a better way ? > > > If you are using .NET 2.0, you may want to use 'Integer.TryParse'. In > .NET 1.0/1.1 you can use 'Integer.Parse' + exception handling. Maybe > using 'IsNumeric' is an option too. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> Integer...they did for Double... <shrug> :) MythranYou can read the historic reason for the existence Double.TryParse in
previous versions at: http://msdn.microsoft.com/msdnmag/issues/06/01/CLRInsideOut/default.aspx -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET, VB6, VB5 and VBA You can code, design and document much faster in VB.NET, C#, C++ or VJ# Free resources for add-in developers: http://www.mztools.com "Mythran" <kip_potter@hotmail.comREMOVETRAIL> escribió en el mensaje news:OeM2bUyEGHA.564@TK2MSFTNGP10.phx.gbl... > > > Hmm, I have wondered for a long while why they didn't make a TryParse for > Integer...they did for Double... > > <shrug> > > :) > > Mythran >
Armin - Start sound problem revived in new thread
Use of delegate SetWindowsHookEx and VB.NET 2005 A Framework for Datadriven Forms for VB Dot Net Byte Array, Datagrid Simple Example of How to Implement SerialPort Class Paging, Filtering and Sorting Db Interaction spped issue with upgraded code from vb6 to vb.net Add a line break in label.text populating text boxes... |
|||||||||||||||||||||||