zpx-utils 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package zpx-utils --version 1.0.0
                    
NuGet\Install-Package zpx-utils -Version 1.0.0
                    
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="zpx-utils" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="zpx-utils" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="zpx-utils" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add zpx-utils --version 1.0.0
                    
#r "nuget: zpx-utils, 1.0.0"
                    
#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.
#:package zpx-utils@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=zpx-utils&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=zpx-utils&version=1.0.0
                    
Install as a Cake Tool

ZopoxoUtils Documentation Overview The ZopoxoUtils namespace provides utility extension methods for string manipulation and numeric operations. It includes two main extension classes: StringExtensions and IntegralExtensions, each containing a variety of helpful methods to streamline common tasks. Classes

  1. StringExtensions The StringExtensions class provides a set of extension methods for string manipulation, including removing special characters, extracting numeric values, and mapping strings to predefined zones. Methods: � RemoveSpecialCharacters(string input) Removes special characters from the input string, leaving only alphanumeric characters, periods, and spaces. � ExtractNumericValueFromString(string input) Extracts numeric values from the input string, removing all non-numeric characters except for periods and spaces. � MapToZone(string input) Maps the input string to a predefined zone based on its value, after removing special characters and ignoring case. � RemoveSpaces(string input) Removes all spaces (including tabs, newlines, etc.) from the input string. � RemoveBackSlash(string input) Removes backslashes and special characters like \n, \t, \b, \r, \f, etc., from the input string. � EscapeCSVString(string input) Escapes CSV-specific characters in the input string, such as commas, double quotes, and newline characters, to make it CSV-compatible. � TrimPhoneNumber(string number) Removes all non-numeric characters from the input string and trims it to the last 10 digits if the length exceeds 10.

  2. GenricListExtention

Methods:

The GenricListExtention class provides extension methods for working with generic lists and dictionaries. It contains methods to convert a list of objects into a list of dictionaries, as well as methods to convert these dictionaries into CSV formats, either as a byte array or a memory stream.

Features Convert any List<T> to a List of Dictionary<string, object>: This method takes a generic list of objects and converts each object into a dictionary of property names and values.

Convert Dictionary to CSV as Byte Array: Converts a list of dictionaries into CSV format and returns the result as a byte array.

Convert Dictionary to CSV as MemoryStream: Converts a list of dictionaries into CSV format and returns the result as a MemoryStream object.

Usage

  1. Convert a List to a List of Dictionaries Method: ConvertToDictionaryList<T>

This method takes a list of any type T and converts it to a List<Dictionary<string, object>>.

Example:

var listOfObjects = new List<YourClass> { new YourClass(), new YourClass() }; var dictionaryList = listOfObjects.ConvertToDictionaryList(); Parameters: models: A generic list of type T (where T is a class). Returns: A List<Dictionary<string, object>> containing property names and values for each object in the input list. 2. Convert Dictionary List to CSV Byte Array Method: ConvertDictionaryToCSV

This method converts a list of dictionaries into a CSV formatted byte array.

Example:

var byteArray = dictionaryList.ConvertDictionaryToCSV(); Parameters: data: A list of dictionaries where each dictionary represents a row in the CSV. Returns: A byte[] containing the CSV data. 3. Convert Dictionary List to CSV MemoryStream Method: ConvertDictionaryToStream

This method converts a list of dictionaries into a CSV formatted MemoryStream.

Example: csharp Copy code var memoryStream = dictionaryList.ConvertDictionaryToStream(); Parameters: data: A list of dictionaries where each dictionary represents a row in the CSV. Returns: A MemoryStream containing the CSV data. Notes The methods utilize reflection to read property names and values from the provided objects. Only properties with the IncludeInDictionaryAttribute attribute will be included in the converted dictionary. Make sure to define the EscapeCSVString() extension method to handle special characters in CSV data. Dependencies Namespace: Ensure that the necessary namespaces are included:

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; 3. IntegralExtensions The IntegralExtensions class provides a set of extension methods for numeric operations, including conversions between grams and kilograms and summing numbers. Methods: Methods: � ConvertGramsToKilograms<T>(T input) Converts the given input from grams to kilograms. Supports int, double, float, and decimal types. Returns the converted value or the original input if the type is unsupported. � ConvertKilogramsToGrams<T>(T input) Converts the given input from kilograms to grams. Supports int, double, float, and decimal types. Returns the converted value or the original input if the type is unsupported. � SumTwoNumbers(int number1, int number2) Sums two integer numbers and returns the result. � SumThreeNumbers(int number1, int number2, int number3) Sums three integer numbers and returns the result. � SumNumbers(params int[] numbers) Sums a variable number of integer numbers. Returns the sum of the numbers or 0 if the input is null or empty. � RoundOff<T>(T input) Rounds off the given input to two decimal places. Supports double and decimal types. Returns the rounded value or the original input if the type is unsupported.

  1. Type Casting Extensions Methods: � ConvertObjectToSpecificType<T>(object input) Converts an object to a specific type T. The type T can be any data type (e.g., int, string, etc.). If the type is a string, it will remove backslashes from the input string. Returns default(T) if the input is DBNull, otherwise, returns the converted value of type T.

License This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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