Thursday, July 23, 2015

c# in string

In C#, you can use strings as array of characters. However, more common practice is to use the string keyword to declare a string variable. The string keyword is an alias for theSystem.String class.
Methods of the String Class

1.       public static int Compare( string strA, string strB )
Compares two specified string objects and returns an integer that indicates their relative position in the sort order.
2.        public static string Concat( string str0, string str1 )= Concatenates two string objects.
3.       public static string Concat( string str0, string str1, string str2 )= Concatenates three string objects.
4.       public static string Concat( string str0, string str1, string str2, string str3 ) =Concatenates four string objects.
5.       public static string Copy( string str ) =Creates a new String object with the same value as the specified string.
6.       public static string Join( string separator, params string[] value ) =Concatenates all the elements of a string array, using the specified separator between each element.
7.       public string Replace( char oldChar, char newChar )= Replaces all occurrences of a specified Unicode character in the current string object with the specified Unicode character and returns the new string.
8.        public string Replace( string oldValue, string newValue )=Replaces all occurrences of a specified string in the current string object with the specified string and returns the new string.

9.       public string Replace( char oldChar, char newChar ) Replaces all occurrences of a specified Unicode character in the current string object with the specified Unicode character and returns the new string. 

No comments:

Post a Comment