From 6687bdeb370ec82084525df476affe3bc7ffdfa2 Mon Sep 17 00:00:00 2001 From: Derek Stegelman Date: Mon, 23 Dec 2024 13:38:54 -0700 Subject: [PATCH] Add string extension --- CsuChhs.Extensions/CsuChhs.Extensions.csproj | 2 +- CsuChhs.Extensions/StringExtensions.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CsuChhs.Extensions/CsuChhs.Extensions.csproj b/CsuChhs.Extensions/CsuChhs.Extensions.csproj index 9ee5ddb..b59f3ac 100644 --- a/CsuChhs.Extensions/CsuChhs.Extensions.csproj +++ b/CsuChhs.Extensions/CsuChhs.Extensions.csproj @@ -6,7 +6,7 @@ enable true CHHS Application Development Team - 1.5.2 + 1.5.3 https://github.com/csu-chhs/CsuChhs.Extensions College of Health and Human Sciences CsuChhs.Extensions diff --git a/CsuChhs.Extensions/StringExtensions.cs b/CsuChhs.Extensions/StringExtensions.cs index 93814c0..8e01120 100644 --- a/CsuChhs.Extensions/StringExtensions.cs +++ b/CsuChhs.Extensions/StringExtensions.cs @@ -65,6 +65,17 @@ public static string ToTwelveHourTime(this string value) return $"{newTime.Value}:{value.Substring(2)} {amPm2}"; } + /// + /// Convert string into a URL encoded string. Safe to + /// put in URLS + /// + /// + /// + public static string ToUrlEncodedString(this string value) + { + return Uri.EscapeDataString(value); + } + /// /// Converts a possible URL without scheme into /// one with an acceptable scheme.