VTNET.Extensions 1.4.6

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

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

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 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.6 is deprecated because it has critical bugs.
7.1.5 124 7/16/2024 7.1.5 is deprecated because it has critical bugs.
7.1.4 99 7/15/2024 7.1.4 is deprecated because it has critical bugs.
7.1.3 106 7/15/2024 7.1.3 is deprecated because it is no longer maintained.
7.1.2 186 5/7/2024 7.1.2 is deprecated because it is no longer maintained.
7.1.1 144 5/7/2024 7.1.1 is deprecated because it is no longer maintained.
7.1.0 114 5/2/2024 7.1.0 is deprecated because it is no longer maintained.
7.0.3 180 2/28/2024 7.0.3 is deprecated because it is no longer maintained.
7.0.2 145 2/27/2024 7.0.2 is deprecated because it is no longer maintained.
7.0.1 196 2/21/2024 7.0.1 is deprecated because it is no longer maintained.
7.0.0 140 2/21/2024 7.0.0 is deprecated because it is no longer maintained.
2.1.4 151 1/18/2024
2.1.3 180 1/15/2024 2.1.3 is deprecated because it is no longer maintained.
2.1.2 194 12/22/2023 2.1.2 is deprecated because it is no longer maintained.
2.1.1 194 12/3/2023 2.1.1 is deprecated because it is no longer maintained.
2.1.0 161 12/3/2023 2.1.0 is deprecated because it is no longer maintained.
2.0.3 157 12/2/2023 2.0.3 is deprecated because it is no longer maintained.
2.0.2 183 11/21/2023 2.0.2 is deprecated because it is no longer maintained.
2.0.1 184 11/3/2023 2.0.1 is deprecated because it is no longer maintained.
2.0.0 260 10/12/2023 2.0.0 is deprecated because it is no longer maintained.
1.4.11 185 9/27/2023 1.4.11 is deprecated because it is no longer maintained.
1.4.10 276 9/8/2023 1.4.10 is deprecated because it is no longer maintained.
1.4.9 158 9/6/2023 1.4.9 is deprecated because it is no longer maintained.
1.4.8 156 9/6/2023 1.4.8 is deprecated because it has critical bugs.
1.4.7 172 9/5/2023 1.4.7 is deprecated because it is no longer maintained.
1.4.6 193 8/31/2023 1.4.6 is deprecated because it is no longer maintained.
1.4.5 210 8/22/2023 1.4.5 is deprecated because it is no longer maintained.
1.4.4 199 8/22/2023 1.4.4 is deprecated because it is no longer maintained.
1.4.3 205 8/11/2023 1.4.3 is deprecated because it is no longer maintained.
1.4.2 210 8/10/2023 1.4.2 is deprecated because it has critical bugs.
1.4.1 190 8/10/2023 1.4.1 is deprecated because it has critical bugs.
1.4.0 294 8/3/2023 1.4.0 is deprecated because it has critical bugs.
1.3.0-beta 194 6/9/2023 1.3.0-beta is deprecated because it has critical bugs.
1.2.1-beta 174 6/7/2023 1.2.1-beta is deprecated because it has critical bugs.
1.2.0-beta 165 6/6/2023 1.2.0-beta is deprecated.
1.1.2-beta 163 5/31/2023 1.1.2-beta is deprecated.
1.1.1-beta 164 5/31/2023 1.1.1-beta is deprecated.
1.1.0-beta 175 5/30/2023 1.1.0-beta is deprecated.
1.0.1-beta 172 5/25/2023 1.0.1-beta is deprecated.
1.0.0-beta 160 5/25/2023 1.0.0-beta is deprecated.