Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sort String
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string [] times = new string[] {"Ken-01:14:00", "Sol-02:06:00", "Ben-04:09:00", "Lolly-11:12:01", "Sam-02:06:02" }; Array.Sort(times, TimerSort); foreach(string t in times) Console.WriteLine("Times : " + t); } static int TimerSort(string a, string b){ string [] _a1 = a.Split(); string [] _b1 = b.Split(); string [] _a = _a1[1].Split(':'); string [] _b = _b1[1].Split(':'); int i = 0, ret = 0; for( ; i < _a.Length ; ++i){ ret = int.Parse(_a[i]).CompareTo(int.Parse(_b[i])); if(ret != 0) return ret; } return ret; } } }
run
|
edit
|
history
|
help
0
Sequential n Take ex
Fuuuu
0/1 Knapsack problem using Iterative Approach
30272 Program Ex6_1 else_if
Custom thousand separator
https://www.compliantmechanisms.byu.edu/profile/new-free-robux-generator-2022/profile
WallPascal
Nuzrath 284
FileNameCharCheck
asdfrgthyjuhtgrfed