- Go to "Tools > NuGet Package Manager > Manage NuGet Packages for Solution"
- Go to "Browse" tab and search for "CSSimpleFunctions" and simply install the latest version
dotnet add package CSSimpleFunctions --version [latest release version]
Note: Remove the brackets for version
- will check a String for a number
- returns a boolean value
Check.HasNumbers("Sample text"); // returns false
Check.HasNumbers("Sample text 1"); // returns true- will check a String for a symbol
- returns a boolean value
Check.HasSymbols("Sample text"); // returns false
Check.HasSymbols("Sample text!"); // returns true- will check a String for a space
- returns a boolean value
Check.HasSpaces("Sample_text"); // returns false
Check.HasSpaces("Sample text"); // returns true- will check a String if it is a valid Philippine mobile number
- returns a boolean value
Check.IsAValidPhilippineMobileNumber("+15551234567"); // returns false
Check.IsAValidPhilippineMobileNumber("09171234567"); // returns true- adds a valid domain name to the list of valid domain names
Check.Email.AddValidDomainName("gmail");- adds a valid domain extension to the list of valid domain extensions
Check.Email.AddValidDomainExtension("com");- adds a valid domain to the list of valid domains
Check.Email.AddValidDomain("gmail.com");- sets the checker to use full domains or not
Check.Email.ShouldUseFullDomain();
// Or
Check.Email.ShouldUseFullDomain(true);
// Or
Check.Email.ShouldUseFullDomain(false);- checks a String if it is a valid email or not
- will return false if the email domain is not listed in the valid domains
Check.Email.IsValid("test@gmail.com"); // returns true
Check.Email.IsValid("test@outlook.com"); // returns false
Check.Email.IsValid("test@asd.com"); // returns false- will reverse a String
Convert.Reverse("Sample text"); // returns "txet elpmaS"- will convert a String to its Base64 version
- returns a String
Convert.ToBase64("Sample text"); // returns "U2FtcGxlIHRleHQ="- will convert a Base64 String to its normal version
- returns a String
Convert.FromBase64("U2FtcGxlIHRleHQ="); // returns "Sample text"- will convert a String to a byte array
- returns a byte array
byte[] byteArray = Convert.ToByteArray("Sample text");- will convert a byte array to a String
- returns a String
byte[] byteArray = Convert.ToByteArray("Sample text");
string temp = Convert.FromByteArray(byteArray);Run Python 3.12 scripts and commands from C#
PyCS pycs = new PyCS();
// Or
PyCS pycs = new PyCS(true); // default value
PyCS pycs = new PyCS(false); // no console messages- download and install pip for PyCS
pycs.InstallPip();- starts a pip install command
pycs.Pip(new string[]
{
"numpy"
});- starts a pip install command for already downloaded .whl files
pycs.PipLocal(new string[]
{
"numpy-2.2.6-cp312-cp312-win32.whl",
"opencv_python-4.12.0.88-cp37-abi3-win32.whl"
});- runs a given Python script in a string value
pycs.Run("print('Hello')"); // prints "Hello" in the console- runs a given Python script in a given file path
pycs.RunFile("scripts/hello.py"); // prints "Hello" in the console- runs a given Python script in a string value and returns the console message in a string value
string text = pycs.GetOutput("print('Hello')"); // returns "Hello"- runs a given Python script in a given file path and returns the console message in a string value
string text = pycs.GetFileOutput("scripts/hello.py"); // returns "Hello"- writes text to a file
SimpleFileHandler.Write("path/to/file.txt", "Sample text");- reads text from a file
string text = SimpleFileHandler.Read("path/to/file.txt");- appends text to a file
SimpleFileHandler.Append("path/to/file.txt", "Sample text 2");- extract a file from the project to a given location
SimpleFileHandler.ProjectToLocation(Assembly.GetExecutingAssembly(), "SampleClass.cs");
// Or
SimpleFileHandler.ProjectToLocation(Assembly.GetExecutingAssembly(), "SampleClass.cs", "path/to/destination");