added things

This commit is contained in:
didier amyot committed 2023-08-15 09:28:29 -04:00
1 parent eed3373822
commit 021aa017f3
6 files changed
+159 -18

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
namespace Algorithms;
using System;
using Algorithms.NumberTheory;
class SolutionExercices1 {
public static string removeTitle(string header)
{
int idx = header.IndexOf(".");
return header.Substring(idx + 1);
}
public static void printEachDirectoryOnPath(string path)
{
string[] subs = path.Split(':');
foreach (var sub in subs)
{
Console.WriteLine(sub);
}
}
public static void Main_(String[] args){
// {titre}.{sous-titre}.{sous-sous- titre}
// 4.56.2 -> 56.2
// 4.b.ii -> b.ii
string header = "4.56.2";
Console.WriteLine(removeTitle("4.56.2")); // "56.2"
Console.WriteLine(removeTitle("4.b.ii")); // "b.ii"
Console.WriteLine(removeTitle("")); // ""
Console.WriteLine(removeTitle("4.b")); // "b"
string? path = Environment.GetEnvironmentVariable("PATH");
printEachDirectoryOnPath(path ?? "");
}
}