Sort Char without using Array.Sort() - VB.net -
i practicing code anagram, find easy since there method called array.sort().
without using method above, how sort them alphabetically? switched java vb.net , still learning yea :)
assume code:
module module1 sub main() dim str1, str2, str3 string dim char1(), char2(), char3() char console.writeline("enter 1st string:") str1 = console.readline().tolower.replace(" ", "") console.writeline("enter 1st string:") str2 = console.readline().tolower.replace(" ", "") console.writeline("enter 1st string:") str3 = console.readline().tolower.replace(" ", "") char1 = str1.tochararray() char2 = str2.tochararray() char3 = str3.tochararray() end sub end module
if can use linq, can call orderby() extension on array. here's examples in c#.
'orderby' in linq using string array c#
you might this:
dim ordered char() = char1.orderby(function(x) x).toarray()
Comments
Post a Comment