uk.joshc.InputValidator
1.0.0
dotnet add package uk.joshc.InputValidator --version 1.0.0
NuGet\Install-Package uk.joshc.InputValidator -Version 1.0.0
<PackageReference Include="uk.joshc.InputValidator" Version="1.0.0" />
paket add uk.joshc.InputValidator --version 1.0.0
#r "nuget: uk.joshc.InputValidator, 1.0.0"
// Install uk.joshc.InputValidator as a Cake Addin #addin nuget:?package=uk.joshc.InputValidator&version=1.0.0 // Install uk.joshc.InputValidator as a Cake Tool #tool nuget:?package=uk.joshc.InputValidator&version=1.0.0
Josh's Input Validator
Tool for validating user input in C# console applications.
Using the package
To use the package install the uk.joshc.InputValidator NuGet package.
Import the package with using InputValidator;
where you need it.
Methods
All methods can be accessed from the Input
class.
Validate Yes/No
Validate that the user is using Y/N terms.
Input.ValidateYN(string displayMessage)
Takes a display message, which is displayed to the user.
Returns true for yes, false for no.
Acceptable input from the user is:
- Yes
- Y
- No
- N
Input is not case sensitive.
Validate Array
Inputs can be validated to ensure they the message is within the array.
Input.ValidateArray(string displayMessage, string[] acceptedValues)
Takes a display message, which is displayed to the user and a string array including all the values of that are accepted.
Returns a lowercase string with the input if it is accepted.
Example
string mainMenuInput = Input.ValidateArray("What would you like to do?" +
"\n [L]ist current cards in deck" +
"\n [S]huffle Cards in deck" +
"\n [D]eal a card" +
"\n [E]xit",
new string[] { "l", "s", "d", "e" });
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 347 | 4/20/2021 |