IvanStoychev.Useful.String.Extensions
A .Net library of useful extension methods for the "string" class in C#.
Install / Use
/learn @IvanStoychev/IvanStoychev.Useful.String.ExtensionsREADME
| Table of Contents | | --------------------- | | <a href="#-join-the-community">💬 Community</a> | | <a href="#sparkling_heart-support-the-project">:sparkling_heart: Support</a> | | <a href="#-introduction">📣 Introduction</a> | | <a href="#-demo">🎬 Demo</a> | | <a href="#-features">🚀 Features</a> | | <a href="#-installation">🏗 Installation</a> | | <a href="#ℹ-how-to-use">ℹ How to use</a> | | <a href="#-examples">🎞 Examples</a> | | <a href="#-documentation">📖 Documentation</a> | | <a href="#-contribution">🧙 Contribution</a> |
</div> <br/>💬 Join the community
<div align="center"> </div> <br/>:sparkling_heart: Support the project
<div align="center"> </div> <br/>📣 Introduction
This is a collection of string extension methods that I have been in need of many a time, so I bundled them in a nuget package and published the code here. They are designed to be "ease-of-life" and "generally making your life easier" methods with user comfort in mind, which is why there are numerious overloads, designed for every case I could think of.
<br/>🎬 Demo
<div align="center">https://github.com/user-attachments/assets/bba2b379-1737-425d-a809-6c57973ea2b9
</div> <br/>🚀 Features
- [
Substring][9] methods that use string arguments to determine a substring's position, instead of a starting index.- Ex.
"This is the start bla bladdy blah.".Substring("start ", false)will return"bla bladdy blah.", while"This is the start bla bladdy blah and this is the end.".Substring("start ", "blah", StringInclusionOptions.IncludeNone)will return"bla bladdy ".
- Ex.
- [
Replace][8] methods that take a series of strings or characters and replace all their occurrences in the original string with a provided value.- Ex.
"Cucumbers, oranges and apples are vegetables.".Replace("tomatoes", "oranges", "apples")will return"Cucumbers, tomatoes and tomatoes are vegetables.".
- Ex.
- [
Contains][7] methods that check if a string contains any of a series of provided values.- Ex.
"brake wheel icon number stoic".Contains("keen", "wild", "icon")will returntrue.
- Ex.
- [
Remove][6] methods that take a series of strings or characters and clear all their occurrences from the string with a single method call.- Ex.
"Lorem ipsum dolor Lorem ipsum sit amet".Remove("Lorem ", "ipsum ", "t")will return"dolor si ame".
- Ex.
- [
TrimStart][6] and [TrimEnd][6] methods that take a string and remove it from the start or end of the original string.- Ex.
"In the beginning there was an end".TrimStart("In the beginning ")will return"there was an end", while"In the beginning there was an end".TrimEnd(" an end")will produce"In the beginning there was".
- Ex.
- Methods to keep or remove all special characters, letters and digits from a string.
- Ex.
"!#%&lorem^@ipsum!@%".KeepOnlyLetters()will return"loremipsum".
- Ex.
- And much more.
🏗 Installation
Install using "NuGet Package Manager" in Visual Studio <br/>1. Open the solution to which you wish to add the library. <br/>2. Open the "NuGet Package Manager".
- Option 1 (allows installation to multiple projects in the solution) <br/>In "Solution Explorer" right-click the solution and choose "Manage NuGet Packages for Solution...".
- Option 2 (allows installation to multiple projects in the solution) <br/>Click the "Tools" menu bar item, navigate to "NuGet Package Manager" and select "Manage NuGet Packages for Solution...".
- Option 3 (allows installation only to a single project) <br/>Right-click the project, to which you wish to add the library, and choose "Manage NuGet Packages...".
<br/>3. Make sure your "Package source:" (found in the upper-right corner) is pointing to a nuget source that has the library in its catalogue, for example "nuget.org". <br/>4. Make sure you're in the "Browse" section (located in the upper-left corner). <br/>5. Enter "IvanStoychev.Useful.String.Extensions" in the search box. <br/>6. Select the "IvanStoychev.Useful.String.Extensions" package and choose a version to intall. <br/>6.1. If you've opened the Package Manager using option 1 or 2 you can select which projects to install the library to. <br/>7. Click the "Install" button and read the licence terms. Choose whether you agree to them or not.
<br/>Install manually
<br/>1.a. Download the package from [NuGet][4], [Github packages][5] or the [Releases][2] page.
<br/>-or-
<br/>1.b. Clone the repo and build in it "Release" mode, which will produce a package file in the project's release dir - "~\IvanStoychev.Useful.String.Extensions\IvanStoychev.Useful.String.Extensions\bin\Release".
<br/>2. Make sure you have the .NET CLI installed.
<br/>3. Open a command line and Run the command dotnet add <PROJECT> package <PACKAGE>.
<br/>where:
<br/><PROJECT> is the path to the *.csproj file to which you want to add the package (if it is located in the command line's working directory you can omit this parameter).
<br/><PACKAGE> is the path to the package you have downloaded.
<br/>
<br/>Install using "Package Manager Console"
<br/>1. Run this command in the "Package Manager Console": Install-Package IvanStoychev.Useful.String.Extensions.
<br/>
<br/>Install using PackageReference
<br/>1. Add this line, in an "<ItemGroup>", to your .csproj file <PackageReference Include="IvanStoychev.Useful.String.Extensions" Version="VersionNumber"/>.
<br/>where:
<br/>VersionNumber is the version of the package you wish to use, e.g. 1.0.0.
<br/>
<br/>__*Install usi
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
Languages
Security Score
Audited on Oct 16, 2025
