views:

33

answers:

3

Any programming language. I'm interested in knowing what top 5 methods in a string class are used on data manipulations. Or what top 5 methods does one need to know to be able to handle data manipulation. I know probably all the methods together should be used, but I'm interested to see the 5 most common methods people use.

Thanks for your time.

+3  A: 

I'd say

  1. String.Format()
  2. String.Split()
  3. String.IndexOf()
  4. String.Substring()
  5. String.ToUpper()
Adam Driscoll
+3  A: 

Adam's top 5 are pretty much mine. I might replace IndexOf() with Trim(); I use this EVERY TIME I get a value from the user. String.Compare() using the IgnoreCase values of the StringComparison enumeration would replace most of the uses I've seen for ToUpper().

Format, HEAVILY used in logs and other user messages (far more efficient for templated messages than a bunch of += statements or a StringBuilder()). Split and Substring, ditto, especially in file processing.

KeithS
Ooo I didn't think about Trim that's a good one. String.Compare is also a good alternative to ToUpper()
Adam Driscoll
+2  A: 

Adam's + KeithS. But don't forget the under the hood calls to String.hashCode(), String.equals(String rhs) and its ilk.

Captain Giraffe