6 kyu

Sort the columns of a csv-file

118 of 1,068user5036852

Description:

#Sort the columns of a csv-file

You get a string with the content of a csv-file. The columns are separated by semicolons.
The first line contains the names of the columns.
Write a method that sorts the columns by the names of the columns alphabetically and incasesensitive.

An example:

Before sorting:
As table (only visualization):
|myjinxin2015|raulbc777|smile67|Dentzil|SteffenVogel_79|
|17945       |10091    |10088  |3907   |10132          |
|2           |12       |13     |48     |11             |

The csv-file:
myjinxin2015;raulbc777;smile67;Dentzil;SteffenVogel_79\n
17945;10091;10088;3907;10132\n
2;12;13;48;11

----------------------------------

After sorting:
As table (only visualization):
|Dentzil|myjinxin2015|raulbc777|smile67|SteffenVogel_79|
|3907   |17945       |10091    |10088  |10132          |
|48     |2           |12       |13     |11             |

The csv-file:
Dentzil;myjinxin2015;raulbc777;smile67;SteffenVogel_79\n
3907;17945;10091;10088;10132\n
48;2;12;13;11

There is no need for prechecks. You will always get a correct string with more than 1 line und more than 1 row. All columns will have different names.

Have fun coding it and please don't forget to vote and rank this kata! :-)

I have created other katas. Have a look if you like coding and challenges.

Strings
Arrays
Algorithms
Sorting

Stats:

CreatedOct 7, 2016
PublishedOct 7, 2016
Warriors Trained2668
Total Skips140
Total Code Submissions4265
Total Times Completed1068
C# Completions118
JavaScript Completions324
Java Completions162
Python Completions407
TypeScript Completions95
CoffeeScript Completions9
C Completions19
Total Stars81
% of votes with a positive feedback rating94% of 282
Total "Very Satisfied" Votes253
Total "Somewhat Satisfied" Votes26
Total "Not Satisfied" Votes3
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • user5036852 Avatar
  • suic Avatar
  • Dentzil Avatar
  • Blind4Basics Avatar
  • hobovsky Avatar
  • meni181818 Avatar
  • saudiGuy Avatar
Ad