-
-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expect YouTube to provide 3-letter language codes by itself sometimes
- Loading branch information
Showing
5 changed files
with
30 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 13 additions & 1 deletion
14
YoutubeExplode.Converter/Utils/Extensions/StringExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
namespace YoutubeExplode.Converter.Utils.Extensions; | ||
using System; | ||
|
||
namespace YoutubeExplode.Converter.Utils.Extensions; | ||
|
||
internal static class StringExtensions | ||
{ | ||
public static string? NullIfWhiteSpace(this string s) => | ||
!string.IsNullOrWhiteSpace(s) ? s : null; | ||
|
||
public static string SubstringUntil( | ||
this string str, | ||
string sub, | ||
StringComparison comparison = StringComparison.Ordinal | ||
) | ||
{ | ||
var index = str.IndexOf(sub, comparison); | ||
return index < 0 ? str : str[..index]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters