Mar 12, 2008 #1 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
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
Mar 12, 2008 #2 JurkMonkey Programmer Nov 23, 2004 1,731 CA Equ.IndexOf(">") < 0 That line is returning false. Look at your input string http://www.ubuntu.com/ Upvote 0 Downvote
Mar 12, 2008 Thread starter #3 jamert Programmer Dec 9, 2007 80 CA 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 Upvote 0 Downvote
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
Mar 12, 2008 #4 JurkMonkey Programmer Nov 23, 2004 1,731 CA if ((Equ.IndexOf("<") >= 0) || (Equ.IndexOf(">") >= 0)) { //The Equ string contains a < or a > } Is this what you're going for? http://www.ubuntu.com/ Upvote 0 Downvote
if ((Equ.IndexOf("<") >= 0) || (Equ.IndexOf(">") >= 0)) { //The Equ string contains a < or a > } Is this what you're going for? http://www.ubuntu.com/
Mar 13, 2008 #5 jmeckley Programmer Jul 15, 2002 5,269 US 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. Upvote 0 Downvote
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.