/// <summary> ///convert a string array into a shaped array and bubble sort/// </summary> /// <param name= "str" ></param> /// <returns></returns> Private int[] Arrtoint (string[] str) { int[] arr2 =New int[Str. Length];//used to store strings converted to int[] for(inti =0; I < Str. Length; i++) {Arr2[i]=int. Parse (Str[i]); } intLen =arr2. Length; for(intj =0; J < Len; ++j) { for(inti = j; i < Len; ++i) {if(Arr2[j] >Arr2[i]) { inttemp =Arr2[j]; ARR2[J]=Arr2[i]; Arr2[i]=temp; } } } returnarr2; } /// <summary> ///reorganizing an array/// </summary> /// <param name= "str" ></param> /// <returns></returns> Public string[] Strto (string[] str) {ArrayList Al=NewArrayList ();//remove duplicate elements from an array for(inti =0; I < Str. Length; i++) { if(Al. Contains (str[i]) = =false&& Str[i]! ="") {al. ADD (Str[i]); } } //convert ArrayList to arraystr =New string[Al. Count]; STR= (string[]) al. ToArray (typeof(string)); returnstr; }
Array manipulation-removing duplicates and whitespace elements