VTNET.Extensions 1.4.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package VTNET.Extensions --version 1.4.8                
NuGet\Install-Package VTNET.Extensions -Version 1.4.8                
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.4.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VTNET.Extensions --version 1.4.8                
#r "nuget: VTNET.Extensions, 1.4.8"                
#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.4.8

// Install VTNET.Extensions as a Cake Tool
#tool nuget:?package=VTNET.Extensions&version=1.4.8                

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: StringEx.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()

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;
"Hello".Log(); //Hello

String

string number2 = "1000";
string words = number2.ToWords(); // "one thousand"

int amount = 1000;
string formattedAmount = amount.Separator(); // "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 reverseString = "Thuaanj".ReverseString(); // "jnaauhT"

",".Join(listValue); //like string.Join(",", listValue);

StringEx.IsNumericString("-3.14").Log(); //true
StringEx.IsNumericString("1,000,000.34", ',').Log(); //true

string lorem = StringEx.Lorem; // "lorem ipsum dolor sit"
string lorem = StringEx.LoremShort; // "lorem ipsum dolor sit"
string lorem = StringEx.LoremLong; // "lorem ipsum dolor sit..."
string lorem = StringEx.LoremIpsum(minWords: 4, maxWords: 64, minSentences: 1, maxSentences: 4, numParagraphs: 4); // "lorem ipsum dolor sit..."

//Convert a number to words:
1000.ToWords(); // "one thousand"

//Set Language
Console.OutputEncoding = Encoding.UTF8;

StringEx.SetLanguageToWords(LangWords.VN);

1000.ToWords(); // "một nghìn"

"abc".Contains(x => x.TextOnly).Log(); //true
"123abc".Contains(x => x.TextOnly).Log(); //false
"abc".Contains(x => x.Number).Log(); //false
"123abc".Contains(x => x.NumberOnly).Log(); //false
"123abc".Contains(x => x.Number).Log(); //true

Number

int num = 69;
bool isEven = num.IsEven(); // false

int num2 = 96;
bool isOdd = num2.IsOdd(); // true

"69".ParseInt();
"6.9".ParseFloat();
"3.14".ParseDouble();

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
//One parameter
CalculateEx.AddSimpleFunction("addone", num =>
{
    return ++num;
});
//Many parameter
CalculateEx.AddFunction("sum", agrs =>
{
    return agrs.Sum();
});
//Operator
CalculateEx.AddOperator('?', (a, b) =>
{
    return Random.Shared.Next((int)a, (int)b);
}, 3);

CalculateEx.AddOperator('#', Math.Max, 3);


"addone(1)> ".Log("addone(1)".Calculate()); //2
"1?100> ".Log("1?100".Calculate());
"sum(a,2,3,4,5,6)> ".Log("sum(a,2,3,4,5,6)".Calculate()); //21
"1#2#3#6#5#4> ".Log("1#2#3#6#5#4".Calculate()); //6

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 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 72 9/17/2024
7.1.8 96 8/14/2024
7.1.7 118 7/16/2024
7.1.6 76 7/16/2024 7.1.6 is deprecated because it has critical bugs.
7.1.5 97 7/16/2024 7.1.5 is deprecated because it has critical bugs.
7.1.4 77 7/15/2024 7.1.4 is deprecated because it has critical bugs.
7.1.3 83 7/15/2024 7.1.3 is deprecated because it is no longer maintained.
7.1.2 149 5/7/2024 7.1.2 is deprecated because it is no longer maintained.
7.1.1 125 5/7/2024 7.1.1 is deprecated because it is no longer maintained.
7.1.0 87 5/2/2024 7.1.0 is deprecated because it is no longer maintained.
7.0.3 142 2/28/2024 7.0.3 is deprecated because it is no longer maintained.
7.0.2 124 2/27/2024 7.0.2 is deprecated because it is no longer maintained.
7.0.1 167 2/21/2024 7.0.1 is deprecated because it is no longer maintained.
7.0.0 120 2/21/2024 7.0.0 is deprecated because it is no longer maintained.
2.1.4 113 1/18/2024
2.1.3 141 1/15/2024 2.1.3 is deprecated because it is no longer maintained.
2.1.2 160 12/22/2023 2.1.2 is deprecated because it is no longer maintained.
2.1.1 173 12/3/2023 2.1.1 is deprecated because it is no longer maintained.
2.1.0 132 12/3/2023 2.1.0 is deprecated because it is no longer maintained.
2.0.3 132 12/2/2023 2.0.3 is deprecated because it is no longer maintained.
2.0.2 152 11/21/2023 2.0.2 is deprecated because it is no longer maintained.
2.0.1 156 11/3/2023 2.0.1 is deprecated because it is no longer maintained.
2.0.0 194 10/12/2023 2.0.0 is deprecated because it is no longer maintained.
1.4.11 158 9/27/2023 1.4.11 is deprecated because it is no longer maintained.
1.4.10 225 9/8/2023 1.4.10 is deprecated because it is no longer maintained.
1.4.9 135 9/6/2023 1.4.9 is deprecated because it is no longer maintained.
1.4.8 137 9/6/2023 1.4.8 is deprecated because it has critical bugs.
1.4.7 144 9/5/2023 1.4.7 is deprecated because it is no longer maintained.
1.4.6 171 8/31/2023 1.4.6 is deprecated because it is no longer maintained.
1.4.5 182 8/22/2023 1.4.5 is deprecated because it is no longer maintained.
1.4.4 175 8/22/2023 1.4.4 is deprecated because it is no longer maintained.
1.4.3 172 8/11/2023 1.4.3 is deprecated because it is no longer maintained.
1.4.2 180 8/10/2023 1.4.2 is deprecated because it has critical bugs.
1.4.1 173 8/10/2023 1.4.1 is deprecated because it has critical bugs.
1.4.0 241 8/3/2023 1.4.0 is deprecated because it has critical bugs.
1.3.0-beta 164 6/9/2023 1.3.0-beta is deprecated because it has critical bugs.
1.2.1-beta 150 6/7/2023 1.2.1-beta is deprecated because it has critical bugs.
1.2.0-beta 142 6/6/2023 1.2.0-beta is deprecated.
1.1.2-beta 141 5/31/2023 1.1.2-beta is deprecated.
1.1.1-beta 142 5/31/2023 1.1.1-beta is deprecated.
1.1.0-beta 145 5/30/2023 1.1.0-beta is deprecated.
1.0.1-beta 146 5/25/2023 1.0.1-beta is deprecated.
1.0.0-beta 139 5/25/2023 1.0.0-beta is deprecated.