VTNET.Extensions
1.1.0-beta
Additional Details
obsolete
This is a prerelease version of VTNET.Extensions.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package VTNET.Extensions --version 1.1.0-beta
NuGet\Install-Package VTNET.Extensions -Version 1.1.0-beta
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VTNET.Extensions" Version="1.1.0-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VTNET.Extensions --version 1.1.0-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: VTNET.Extensions, 1.1.0-beta"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VTNET.Extensions as a Cake Addin #addin nuget:?package=VTNET.Extensions&version=1.1.0-beta&prerelease // Install VTNET.Extensions as a Cake Tool #tool nuget:?package=VTNET.Extensions&version=1.1.0-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Library Name
Library Name is a collection of utility methods for manipulating various data types.
Features
- Check if a string is a number:
"1000".IsNumber()
- Check if a number is even:
69.IsEven()
- Check if a number is odd:
96.IsOdd()
- Convert a number to words:
"1000".ToWords()
- Format a number as currency:
1000.ToCurrency()
- Remove spaces from a string:
"a b c".RemoveDuplicateSpaces()
- Capitalize the first letter of each word in a string:
"vo thanh thuan".Capitalize()
- Convert a string to title case:
"vo thanh thuan".Title()
- Convert a string to title case:
"".Lorem()
- Convert DataTable to List:
var list = dataTable.ToList<model>()
- Support string methods:
IsNullOrEmpty(), IsNullOrWhiteSpace()
- Perform calculations on a string expression:
"1+1".Calculate()
- sin:
"sin(30)".Calculate()
- tan:
"tan(30)".Calculate()
- cos:
"cos(30)".Calculate()
- log:
"log(30)".Calculate()
- factorial:
"4!".Caculate()
- percent:
"44%".Caculate()
- sin:
Installation
You can install the library via NuGet Package Manager. Simply search for Library Name
and install the latest version.
Usage
Here is an example of how to use the library:
using VTNET.Extensions;
string str = "";
bool isEmpty = str.IsNullOrEmpty(); //true
string str = " ";
bool isEmpty = str.IsNullOrWhiteSpace(); //true
string number = "1000";
bool isNumber = number.IsNumber(); // true
int num = 69;
bool isEven = num.IsEven(); // false
int num2 = 96;
bool isOdd = num2.IsOdd(); // true
string number2 = "1000";
string words = number2.ToWords(); // "one thousand"
int amount = 1000;
string formattedAmount = amount.ToCurrency(); // "1,000.00"
string text = "a b c";
string trimmedText = text.RemoveDuplicateSpaces(); // "a b c"
string name = "vo thanh thuan";
string capitalized = name.Capitalize(); // "Vo thanh thuan"
string title = "vo thanh thuan";
string titleCase = title.Title(); // "Vo Thanh Thuan"
string expression = "1+1";
int result = expression.Calculate(); // 2
string titleCase = "".Lorem(); // "lorem ipsum dolor sit"
"Hello".Log(); //like Console.WriteLine("Hello");
",".Join(listValue); //like string.Join(",", listValue);
//Convert DataTable to List
var list = dataTable.ToList<model>();
Calculate
"sin(30)".Calculate(); //sin(30)> -0.9880316240928618
"sin(30deg)".Calculate(); //sin(30deg)> 0.49999999999999994
"tan(30)".Calculate(); //tan(30)> -6.405331196646276
"tan(30deg)".Calculate(); //tan(30deg)> 0.5773502691896257
"cos(30)".Calculate(); //cos(30)> 0.15425144988758405
"cos(30deg)".Calculate(); //cos(30deg)>0.8660254037844387
"log(30)".Calculate(); //log(30)> 1.4771212547196624
"4!".Calculate(); //4!> 44
"44%".Calculate(); //44%> 0.44
//Custom function
CalculateExtension.AddFunction("addOne", (double num) =>
{
return ++num;
});
CalculateExtension.AddOperator('?', (double a, double b) =>
{
return Random.Shared.Next((int)a, (int)b);
},priority: 3);
"addOne(1)> ".Log("addOne(1)".Calculate()); //addOne(1)> 2
"1?100> ".Log("1?100".Calculate());
Convert a number to words:
1000.ToWords(); // "one thousand"
//Set Language
Console.OutputEncoding = Encoding.UTF8;
StringExtension.SetLanguageToWords(LanguageDefinition.VN);
1000.ToWords(); // "một nghìn"
Check True, False
enum Test{a,b,c,d,e,f,g,h}
var a = new Dictionary<string, string>{ { "a", "1"} };
var b = "1";
var c = new List<string>();
var d = new string[]{"1", "2"};
var e = Test.a;
var f = Test.b;
">> IsTrue:".Log();
"a> ".Log(a.IsTrue()); //true
"b> ".Log(b.IsTrue()); //true
"c> ".Log(c.IsTrue()); //false
"d> ".Log(d.IsTrue()); //true
"e> ".Log(e.IsTrue()); //false
"f> ".Log(f.IsTrue()); //true
"--------------------".Log();
">> IsFalse:".Log();
"a> ".Log(a.IsFalse()); //a> false
"b> ".Log(b.IsFalse()); //b> false
"c> ".Log(c.IsFalse()); //c> true
"d> ".Log(d.IsFalse()); //d> false
"e> ".Log(e.IsFalse()); //e> true
"f> ".Log(f.IsFalse()); //f> false
DataTable To List
var list = dataTable.ToList<model>();
//Match column name
var list2 = dataTable.ToList<model>(matchCase: true);
//Convert with cache
var list2 = dataTable.ToListCache<model>(matchCase: true);
//Specify the column name other fields
class TestTable{
[ColumnName("IDX")]
public string Id { get; set; } = "";
[ColumnName("FULLNAME")]
public string Name { get; set; } = "";
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on VTNET.Extensions:
Package | Downloads |
---|---|
VTNET.Vitado
An ADO.NET wrapper library |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
7.1.9 | 126 | 9/17/2024 | |
7.1.8 | 122 | 8/14/2024 | |
7.1.7 | 144 | 7/16/2024 | |
7.1.6 | 99 | 7/16/2024 | |
7.1.5 | 124 | 7/16/2024 | |
7.1.4 | 99 | 7/15/2024 | |
7.1.3 | 106 | 7/15/2024 | |
7.1.2 | 186 | 5/7/2024 | |
7.1.1 | 144 | 5/7/2024 | |
7.1.0 | 114 | 5/2/2024 | |
7.0.3 | 180 | 2/28/2024 | |
7.0.2 | 145 | 2/27/2024 | |
7.0.1 | 196 | 2/21/2024 | |
7.0.0 | 140 | 2/21/2024 | |
2.1.4 | 151 | 1/18/2024 | |
2.1.3 | 180 | 1/15/2024 | |
2.1.2 | 194 | 12/22/2023 | |
2.1.1 | 194 | 12/3/2023 | |
2.1.0 | 161 | 12/3/2023 | |
2.0.3 | 157 | 12/2/2023 | |
2.0.2 | 183 | 11/21/2023 | |
2.0.1 | 184 | 11/3/2023 | |
2.0.0 | 260 | 10/12/2023 | |
1.4.11 | 185 | 9/27/2023 | |
1.4.10 | 276 | 9/8/2023 | |
1.4.9 | 158 | 9/6/2023 | |
1.4.8 | 156 | 9/6/2023 | |
1.4.7 | 172 | 9/5/2023 | |
1.4.6 | 193 | 8/31/2023 | |
1.4.5 | 210 | 8/22/2023 | |
1.4.4 | 199 | 8/22/2023 | |
1.4.3 | 205 | 8/11/2023 | |
1.4.2 | 210 | 8/10/2023 | |
1.4.1 | 190 | 8/10/2023 | |
1.4.0 | 294 | 8/3/2023 | |
1.3.0-beta | 194 | 6/9/2023 | |
1.2.1-beta | 174 | 6/7/2023 | |
1.2.0-beta | 165 | 6/6/2023 | |
1.1.2-beta | 163 | 5/31/2023 | |
1.1.1-beta | 164 | 5/31/2023 | |
1.1.0-beta | 175 | 5/30/2023 | |
1.0.1-beta | 172 | 5/25/2023 | |
1.0.0-beta | 160 | 5/25/2023 |