From 48d49d6e183e734764771a716bcd4b58b6f34d02 Mon Sep 17 00:00:00 2001 From: Patrik Svensson Date: Sat, 28 Aug 2021 23:18:41 +0200 Subject: [PATCH] Add extension method to get the cell width of a character --- .../Extensions/CharExtensions.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Spectre.Console/Extensions/CharExtensions.cs diff --git a/src/Spectre.Console/Extensions/CharExtensions.cs b/src/Spectre.Console/Extensions/CharExtensions.cs new file mode 100644 index 0000000..44b7c9f --- /dev/null +++ b/src/Spectre.Console/Extensions/CharExtensions.cs @@ -0,0 +1,18 @@ +namespace Spectre.Console +{ + /// + /// Contains extension methods for . + /// + public static class CharExtensions + { + /// + /// Gets the cell width of a character. + /// + /// The character to get the cell width of. + /// The cell width of the character. + public static int GetCellWidth(this char character) + { + return Cell.GetCellLength(character); + } + } +}