Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string and indexOf troubles

Status
Not open for further replies.

jamert

Programmer
Dec 9, 2007
80
CA
I con't figure this simpleton out,

any thoughts,

string Equ = "<0.6";
if (Equ.IndexOf("<") < 0 || Equ.IndexOf(">") < 0)
{
// it gets here, don't want it to get here ?
}

Thanks
 
thanks for the pointers:

if (Equ.IndexOf("<") < 0)
{
//something
}
else if (Equ.IndexOf(">") > 0)
{
//something
}
else
{
// end up here, perfect!
}


is there a more elegant way to display this? thanks again
 
this might be a little easier to read
Code:
string input = "<.06";
if(input.StartsWith("<") || input.StartsWith(">"))
{
   //do something;
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top