Subject: Auditions going on now...

From: Open Casting Call <[email-masked]>
Date: Thu, 29 May 2014 08:59:12 -0700

-- Open Casting Call --
New Movie Set to Film

--- Start Update ---

Here is Your chance to be in the Next Big Blockbuster
------------------------------------------------------

- No Experienced Required
- All looks and ages wanted
- castings taking place daily

Get Started Here -> http://www.nonoilmat.com/casting/call/may29.index

--- End Update ---

We are very excited to have brought you this casting call update.
To stop further updates - Update Notice Messages
118 Kecks Lane-Ruff Dale, PA- one five six seven nine or visit http://www.nonoilmat.com/skef.srke33

@SnakeDoc  These are security considerations and, as such, they all depend on the context. Not all applications use perfect security  which does not exist, by the way. Passwords are just an example. And if, instead of passwords, you prefer testing equality on hashes of passwords, same situation : test considering case differences, for security.   Nicolas Barbulesco Aug 24 '13 at 11:56
  	  	
@NicolasBarbulesco I don't see where I said they were mutable. Anyways, I find using .equalsIgnoreCase() happens far more often in my work as I'm often dealing with a file (config file) or direct input that is given by users. If you are expecting a hash, then that would be the "good reason" to use .equals(). Otherwise, it would be silly to expect a string of some_value and have your prog break because user had caps lock on (doh!). It's context sensitive, but again, I find I end up using .equalsIgnoreCase() far more often, usually to protect runtime from bad users  SnakeDoc Aug 28 '13 at 19:02 
  	  	
Another reason why the equality operator does not do what any average human would intuitively think it does is because java does not support operator overloading.   Marquez Sep 18 '13 at 17:20 
  	  	
Small extra note: every time you use "myString" in java code, you are actually creating a private static String with an automatically generated name. Using "myString" twice in the same class should yield the same reference, as the compiler uses the same static class field. It's just syntactic sugar, similar to how an anonymous iterator is created for the construction for(Object o: collection) {}   parasietje Sep 19 '13 at 9:49
 String in java are immutable that means whenever you try to change/modify the string you get a new instance. You cannot change the original string. This has been done so that these string instances can be cached. A typical program contains a lot of string references and caching these instances can decrease the memory footprint and increase the performance of the program.When using == operator for string comparison you are not comparing the contents of the string but are actually comparing the memory address, if they are both equal it will return true and false otherwise. Whereas equals in string compares the string contents.So the question is if all the strings are cached in the system how come == returns false whereas equals return true. Well this is possible. If you make a new string like String str = new String("Test 	  	
== is usefull for primitives than you should use instead of Objects when you can.   David Do@Marquez - On the other hand, operator overloading (as in C++) is why the equality operator sometimes does not do what any average human would intuitively think it does. Concerning the operators in Java, at least you can just look at code and WYSIWYG.   Ted HoRegarding concatenation of literals, will this happen at compile-time if String objects created from literals are unconditionally concatenated in a later line?   hexafraction Nov 9 '13 at 11:57
 @CMS: it'd be great if one of you examples used the lastindexof as used in mark-byers answer --I like your adding it to the class much better than a bare function, but there's no reason it should be slow on large strings. While starting at zeo might be considered "clever" by some, and thus smething to be avoided, I think it s simply a less well known aspect of the language. A comment would be sufficient to remove any confusion for those not as familiar with the language.   jmoreno  you should really delete the .indexOf variant. there's absolutely no reason to use it instead of the .slice variant and people might just copy that one since it's on top, thus the collective processing power of the entire world will decrease because of this inefficiency  -1 for the reason given by Claudiu; having a trail of modifications labelled 'Edit' just makes it more difficult to take in the content on first read-through. Why not delete your initial, inferior implementation and rewrite the answer to 
 inclu 	  	
One minor edit, == is not "much cheaper" than .equals, because the first statement in String.equals reads: if (this == anObject) { return true; }.   Torque @HenrikPaul Yes, thats the Java terminology. But references in Java is more like pointers in C++ terminology, since a reference in C++ behaves like the object it refers to semantically.   user877329 Apr 30 at 12:23