From c2d69ceb710c007954cd34fbb73224af39a62364 Mon Sep 17 00:00:00 2001 From: AaronJamesY Date: Fri, 10 Feb 2017 19:05:26 +0000 Subject: [PATCH] Added StringExtensions --- BankingBot/BankingBot.csproj | 3 +++ BankingBot/Extensions/StringExtensions.cs | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 BankingBot/Extensions/StringExtensions.cs diff --git a/BankingBot/BankingBot.csproj b/BankingBot/BankingBot.csproj index abff66c..908f6ea 100644 --- a/BankingBot/BankingBot.csproj +++ b/BankingBot/BankingBot.csproj @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + false @@ -62,6 +64,7 @@ + diff --git a/BankingBot/Extensions/StringExtensions.cs b/BankingBot/Extensions/StringExtensions.cs new file mode 100644 index 0000000..a32b0c5 --- /dev/null +++ b/BankingBot/Extensions/StringExtensions.cs @@ -0,0 +1,13 @@ +using System; +using System.Text.RegularExpressions; + +namespace BankingBot.Extensions +{ + public static class StringExtensions + { + public static int AsInteger(this string str) + { + return int.Parse(Regex.Replace(str, @"[^\d]", "")); + } + } +}