MyExtensions 0.0.1

dotnet add package MyExtensions --version 0.0.1
                    
NuGet\Install-Package MyExtensions -Version 0.0.1
                    
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="MyExtensions" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MyExtensions" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MyExtensions" />
                    
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 MyExtensions --version 0.0.1
                    
#r "nuget: MyExtensions, 0.0.1"
                    
#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 MyExtensions@0.0.1
                    
#: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=MyExtensions&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MyExtensions&version=0.0.1
                    
Install as a Cake Tool

MyExtensions

A collection of C# helper and extension methods, with a strong focus on Hebrew text processing, filesystem helpers, combinatorics, and string utilities. Most members are static and many are extension methods, so they plug directly into existing types (string, IEnumerable<T>, char).

using MyExtensions;

StringExtensions

String helpers, several of them tailored to Hebrew (nikud, gereshayim, Hebrew letter ranges).

Method Description
IsImageExtention(this string) Returns true if the extension is a known image type (.jpg, .jpeg, .png, .gif, .tiff, .tif, .bmp).
Multiply(this string, int) Repeats the string multiplier times (e.g. "ab".Multiply(3) → "ababab").
Reverse(this string) Returns the string with its characters reversed.
StringLeft(this string, int) Returns the leftmost length characters (the whole string if it is shorter).
replaceIllegalChars(this string) Replaces characters that are illegal in Windows file names (* | : < > ? ' " \ /) with look-alike Unicode equivalents so the text can be used as a file name.
retrieveIllegalChars(this string) Reverse of replaceIllegalChars — restores the original characters from their look-alikes.
DecodeBase64(this string) Decodes a Base64 string into UTF-8 text.
Unify(this string) Normalizes quotes and trims a value down to its Hebrew content, keeping a trailing geresh/apostrophe if present.
removeNikud(this string) Removes Hebrew nikud (vowel points / cantillation) while preserving the makaf (־).
RemoveRegex(this string, string) Removes every match of the given regex pattern from the string.
OnlyHebrewLetters(this string, string? exceptions) Strips everything except Hebrew letters; optional exceptions characters are also kept.
OnlyHebrewAndNikud(this string) Keeps only characters in the Hebrew Unicode blocks (U+0590–U+05FF and U+FB1D–U+FB4F).
RemoveExtension(this string) Removes the file extension (everything from the last .).
DecodeFromUtf8(this string) Reinterprets the string's chars as raw UTF-8 bytes and decodes them (fixes mojibake).
InsertConsideringNikud(this string, int, string) Inserts text at startIndex, skipping forward past any nikud so the insertion lands on the next base Hebrew letter.
CountHebrewLetters(this string) Counts the Hebrew letters (U+05D0–U+05EA) in the string.
IsHebrewChar(this char) Returns true if the char is a Hebrew letter (U+05D0–U+05EA).
HasHebrewLetters(this string) Returns true if the string contains at least one Hebrew letter.
isNikud(string unicode) Returns true if the given hex code point is in the nikud range (U+0591–U+05C7).
HasNikud(this string) Returns true if the string contains any nikud (excluding makaf and sof-pasuk).
RegulateAposDpos(this string) / (this char) Normalizes the many Unicode apostrophe/geresh variants to ' and double-quote/gershayim variants to ".

IEnumerableExtensions

Combinatorics over sequences.

Method Description
Combinations<T>(this IEnumerable<T>, int k) All combinations of exactly k elements (order-independent, no repeats).
CombinationsForAllKs<T>(this IEnumerable<T>) All combinations of every size from 0 to n (the power set).
GetPermutations<T>(this IEnumerable<T>, int length) All ordered permutations of the given length.
GetPermutationsForAllKs<T>(this IEnumerable<T>) All permutations for every length, from longest to shortest.

Extensions

A grab-bag of general-purpose helpers, plus a few Hebrew/NLP utilities.

Hebrew constants & predicates

Member Description
APOS, DPOS, HEBREW_LETTERS String constants of apostrophe variants, double-quote variants, and Hebrew letters (with matching SearchValues<char> for fast scanning).
LettersToNumber(string) Converts Hebrew letters to their gematria numeric value (handles the ט"ו / ט"ז special cases).
isNikud(char) Returns true if the char is a non-spacing mark (i.e. nikud).

Combinatorics

Member Description
Zip(this IEnumerable<string>) Transposes equal-length words into a list of per-position character lists.
GetCombinations(this List<List<char>>, string prefix) Cartesian product of per-position character sets into full strings.
GenerateCombinations(...) Generates all length-N combinations (with repetition) of a set of integers via backtracking.
AllNonEmptySubsets(List<int>) Returns every non-empty subset of the input list.

Sequence helpers

Member Description
Iterate<T>(this IEnumerable<T>) Yields (index, item) tuples.
FindMutual<T>(l1, l2, func) Yields every pair (a, b) from two sequences for which func(a, b) is true.
MyForEach<T>(this IEnumerable<T>, Action<T>) ForEach for any IEnumerable<T>; overload also supplies the index.

Filesystem helpers

Member Description
GetTempFilename(dir, ext) Generates a random, non-existing file name in dir.
GetNewFilename(string) Returns a non-colliding name by appending _001, _002, …
GetNonCollidingFileName(string) Returns a non-colliding name by appending (2), (3), …
GetNewDirectoryName(string) Returns a non-colliding directory name by appending _001, _002, …
GetAllSubFiles(string[]) Recursively enumerates all files under the given files/directories.
CopyDirectory(source, dest, recursive) Copies a directory, optionally recursing into sub-directories.
get_new_filename / get_new_directoryname Obsolete — use GetNewFilename / GetNewDirectoryName.

File reading / iteration

Member Description
ReadLinesWithProgress(file) Lazily reads lines while printing block-based progress to the console.
GetLinesFromFiles(string[]) Yields every line across multiple files.
GetSentencesFromFiles(string[]) Yields sentences (split on .) across multiple files.
EnumerateLines(items) Yields every line across files while printing per-file/per-line progress.
EnumerateSentences(items) Yields sentences (regex sentence-boundary split) across files.

Misc

Member Description
GetInstalledFonts() Yields (name, path) for every font installed on the (Windows) machine.
IsValidRegexPattern(pattern, ...) Returns true if the pattern compiles as a valid regex within the timeout.
ExecuteCommand(string) Runs a command via cmd.exe /C and waits for it to finish.
SplitWithDelimiters(input, delimiters) Splits a string but keeps the delimiters as their own array elements.
CalculateWER(groundTruth, recognized) Computes word-level error rate (edit distance over words) — useful for OCR/ASR evaluation.
ShallowCopyValues<T1, T2>(a, b) Copies matching fields (by name + type) from one object to another via reflection.
DeepCopy<T>(T) Deep-clones an object using DataContractSerializer.

Note: Several filesystem and font helpers are Windows-specific (registry access, cmd.exe, \ separators).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.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
0.0.1 93 6/18/2026
0.0.0 110 2/5/2026