/// <summary> <p> /// Remove underscores from a string and replaces first /// letters with capitals. Other letters are changed to lower case. /// </p> /// * /// <p> /// For example <code>foo_bar</code> becomes <code>FooBar</code> /// but <code>foo_barBar</code> becomes <code>FooBarbar</code>. /// </p> /// * /// </summary> /// <param name="data">string to remove underscores from. /// </param> /// <returns>String /// </returns> /// <deprecated>Use the org.apache.commons.util.StringUtils class /// instead. Using its firstLetterCaps() method in conjunction /// with a StringTokenizer will achieve the same result. /// /// </deprecated> public static System.String removeUnderScores(System.String data) { System.String temp = null; System.Text.StringBuilder out_Renamed = new System.Text.StringBuilder(); temp = data; SupportClass.Tokenizer st = new SupportClass.Tokenizer(temp, "_"); while (st.HasMoreTokens()) { System.String element = (System.String) st.NextToken(); out_Renamed.Append(firstLetterCaps(element)); } return out_Renamed.ToString(); }
/// <summary> Create a string array from a string separated by delim /// * /// </summary> /// <param name="line">the line to split /// </param> /// <param name="delim">the delimter to split by /// </param> /// <returns>a string array of the split fields /// /// </returns> public static System.String[] split(System.String line, System.String delim) { ArrayList list = new ArrayList(); SupportClass.Tokenizer t = new SupportClass.Tokenizer(line, delim); while (t.HasMoreTokens()) { list.Add(t.NextToken()); } return (System.String[]) list.ToArray(typeof(String)); }
/// <summary> <p> /// 'Camels Hump' replacement. /// </p> /// * /// <p> /// Remove one string from another string but leave the capitalization of the /// other letters unchanged. /// </p> /// * /// <p> /// For example, removing "_" from <code>foo_barBar</code> becomes <code>FooBarBar</code>. /// </p> /// * /// </summary> /// <param name="data">string to hump /// </param> /// <param name="replaceThis">string to be replaced /// </param> /// <returns>String /// /// </returns> public static System.String removeAndHump(System.String data, System.String replaceThis) { System.String temp = null; System.Text.StringBuilder out_Renamed = new System.Text.StringBuilder(); temp = data; SupportClass.Tokenizer st = new SupportClass.Tokenizer(temp, replaceThis); while (st.HasMoreTokens()) { System.String element = (System.String) st.NextToken(); out_Renamed.Append(capitalizeFirstLetter(element)); } //while return out_Renamed.ToString(); }