Skip to content

Commit

Permalink
Add Capitalize in Beef (#3707)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuckerm authored Jan 18, 2024
1 parent 0f09f3f commit 8dd389d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions archive/b/beef/Capitalize.bf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;

namespace Capitalize;

class Program
{
public static void Usage()
{
Console.WriteLine("Usage: please provide a string");
Environment.Exit(0);
}

public static void Capitalize(StringView str, ref String capitalized)
{
capitalized.Set(scope $"{str[0].ToUpper}{str[1...]}");
}

public static int Main(String[] args)
{
if (args.Count < 1 || args[0].Length == 0)
{
Usage();
}

String capitalized = scope .();
Capitalize(args[0], ref capitalized);
Console.WriteLine(capitalized);
return 0;
}
}

0 comments on commit 8dd389d

Please sign in to comment.