… <iostream> #include <string> using namespace std; struct…[4]; int main() { string month = "" ; string months[] = {"January"… Discussion Thread by Jemone_1 in Computer Science
…;==". String::compare is your friend. http://www.cplusplus.com/reference/string/string/compare/ Second…: You'll need to compare against each… Reply by Dean_5
2 Months Ago
… <iostream> #include <string> using namespace std; struct…[4]; int main() { string month = "" ; string months[] = {"January"… Discussion Thread by Jemone_1 in Computer Science
… start me off on the compare because I'm not quite… was : !months[0].compare(month), !months[1].compare(month) Is that correct… Reply by Jemone_1
2 Months Ago
… sum of odd numbers"); string usrin = Console.ReadLine(); int usrinnum… Discussion Thread by Brian_22 in Software Development
... or use bitwise operator `if(i&1)` if true even else odd. Its faster because compare one bit only without mathematics Reply by AndrisP
2 Months Ago
… sum of odd numbers"); string usrin = Console.ReadLine(); int usrinnum… Discussion Thread by Brian_22 in Software Development
… harmful. > Its faster because compare one bit only without mathematics… Reply by deceptikon
2 Months Ago
…gt; array(2) { [0]=> string(5) "75849" [1…]=> string(5) "75850" }` This…; array(2) { [0]=> string(5) "33.30"…data if($key != $rowProduct['POProductNet']){//compare the results from the the… Discussion Thread by davidjennings in Programming
2 Months Ago
…all, I am trying to compare data from $_POST['Net'] which…) { ["Submitted"]=> string(4) "true" ["…; } ["ProductCount"]=> string(1) "6" ["…; ["CheckInButton"]=> string(14) "Check In Items… Discussion Thread by davidjennings in Web Development
1 Month Ago
…all, I am trying to compare data from $_POST['Net'] which…) { ["Submitted"]=> string(4) "true" ["…; } ["ProductCount"]=> string(1) "6" ["…; ["CheckInButton"]=> string(14) "Check In Items… Discussion Thread by davidjennings in Web Development
… is the goal of this compare? Reply by cereal
1 Month Ago
…all, I am trying to compare data from $_POST['Net'] which…) { ["Submitted"]=> string(4) "true" ["…; } ["ProductCount"]=> string(1) "6" ["…; ["CheckInButton"]=> string(14) "Check In Items… Discussion Thread by davidjennings in Web Development
… reply The aim of the compare is the user makes a… Reply by davidjennings
1 Month Ago
…all, I am trying to compare data from $_POST['Net'] which…) { ["Submitted"]=> string(4) "true" ["…; } ["ProductCount"]=> string(1) "6" ["…; ["CheckInButton"]=> string(14) "Check In Items… Discussion Thread by davidjennings in Web Development
Hi Cereal, I have produced the below code. Looks a bit long winded Does anyone know of a cleaner solution. while ($rowProduct = mysql_fetch_array($productSQL)) { echo $product[] = $rowProduct['POProductNet']; }… Reply by davidjennings
1 Month Ago
…all, I am trying to compare data from $_POST['Net'] which…) { ["Submitted"]=> string(4) "true" ["…; } ["ProductCount"]=> string(1) "6" ["…; ["CheckInButton"]=> string(14) "Check In Items… Discussion Thread by davidjennings in Web Development
… database // populate the $products array // compare with $files } Reply by cereal
1 Month Ago
…all, I am trying to compare data from $_POST['Net'] which…) { ["Submitted"]=> string(4) "true" ["…; } ["ProductCount"]=> string(1) "6" ["…; ["CheckInButton"]=> string(14) "Check In Items… Discussion Thread by davidjennings in Web Development
Cereal, Thanks for yor help on this. It was good to see your alternative approch to this issue, which I have now implemented to my code as it was more structured and concise. Credit well deserved Thanks David Reply by davidjennings
1 Month Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… a current index for each string - it's going to be… Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… a current index for each string - it's going to be… any other than those 4 string methods : length() charAt() substring() equals… in arrays and start to compare each indexs? but then it… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
…'t work if the first string has consecutive duplicated characters, so… Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… outOfBounds error public static boolean compare(String s,String t) { if (s.equals…; } private static boolean stringChar(String s, String t, int i, int j… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… every character of str1 and compare it to str2, if equal… is "j" and compare it , if not then (recursively… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
Hi Adam That's what I thought at first, but consider the sample data str1=abbcd and str2=abbcccd when processing the first b in str1 you will consume all the b's in str2, then move on to the second b in str1 and find no match... Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
> but i get outOfBounds error When you get an exception ALWAYS post th ecomplete message and the line where it was thrown. Knowing the exact line, and the index value, will make it easy to see what the problem is. and a tiny point, but it … Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
…... public static boolean isTrans(String s,String t) { if (s…); } private static boolean stringChar(String s, String t, int i) { if… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
string up into blocks of repeated (1 or more) chars and compare… } public static RepeatedChar from(String s, int startIndex) { …and comparing them boolean isDup(String str1, String str2) { int i1… Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… > java.lang.StringIndexOutOfBoundsException: > String index out of range: 5… (in java.lang.String) That's a start. Almost…parameter in a call to String's substring method. Now if…in your code where the String method was called, and that… Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
…true.. public static boolean isTrans(String s,String t) { if (s.equals… t); } private static boolean stringChar(String s, String t) { if (s.length… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… as I can tell, you compare the lengths of the two…. After that you strip each string of all occurrences of any… of that letter. Then you compare the two stripped strings and… Reply by AssertNull
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
> i don't want to make an entire class just for comparing those strings i need to include this in a single class within my project.. It's a common beginner mistake to avoid defining a small class because it seems somehow too complicated. Just look … Reply by JamesCherrill
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… using other of the 4 string methods i've mentioned or… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
sorry i qouted accidently the whole texts... my eyes are tired hehe Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
… here.... private static boolean stringChar(String s, String t, char j) { if… Reply by Adam_35
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
Perhaps you can search the string s for the character …function provided by Java's String class? It will return …would be 4. For a string that did NOT contain '…a character is in a string, that function will do …/docs/api/java/lang/String.html#indexOf-int- Reply by AssertNull
3 Weeks Ago
… doing this... public static boolean compare (String s, String t) { boolean result; if… false; } private static int stringSum(String s, int i) { if (i… Discussion Thread by Adam_35 in Software Development
> Perhaps you can search the string s for the character j using the indexOf function provided by Java's String class? sadly no ;( i can't use that function im limited by only 4 : length() charAt() equals() substring() Reply by Adam_35
3 Weeks Ago