Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (13 sloc) 425 Bytes
using System;
using static System.Console;
public class Program {
public static void Main() {
Write($"|{("Hello World".PadBoth(42))}|");
}
}
namespace System {
public static class StringExt {
public static string PadBoth(this string str, int length, char character = ' ') => str.PadLeft((length - str.Length) / 2 + str.Length, character).PadRight(length, character);
}
}
//https://pt.stackoverflow.com/q/41755/101
You can’t perform that action at this time.