A series of string extension methods to make substrings easier. Contains methods such as SubstringOrShorter and Until, making simple code shorter and easier to write.
$ dotnet add package Thindal.StringsThindal.Strings is a project that provides various string manipulation utilities and extensions.
To use Thindal.Strings in your project, download and compile the source code or get the latest release from Nuget.
Since Thindal.Strings are in the System namespace, you don't need to add any using directive beyond using System; to use them.
SubstringOrShorter is a combination of String.IndexOf and String.Substring that returns a substring from the start of the string to the requested length, or the full string if the string is shorter. Usage is the same as Substring but with the suffix OrShorter on the method name.
Until is a method that returns a substring from the start of the string to the first occurrence of a specified character. Usage is the same as IndexOf, but instead it returns a string up until the specified character.
Contributions to Thindal.Strings are welcome! If you find a bug or have a feature request, please open an issue on the GitHub repository. Pull requests are also appreciated.
Thindal.Strings is released under the MIT License.