Skip to main content
Extension methods providing explicit string comparison semantics, making comparison intentions clear and code more readable.

The Problem

StringComparison enums are easy to forget and make code verbose:

The Solution

Equality Comparisons

Ordinal (Case-Sensitive)

Byte-by-byte comparison - fastest, use for identifiers and technical strings:

Case-Insensitive

Culture-invariant case-insensitive comparison:

Contains Comparisons

Ordinal Contains

Case-Insensitive Contains

Prefix/Suffix Checks

StartsWith

EndsWith

IndexOf

Replace

Null/Empty Checks

Fluent alternatives to string.IsNullOrEmpty:

NullIf Normalization

Convert empty/whitespace strings to null for easier null-coalescing:

Truncation

Examples

File Type Detection

URL Validation

Log Parsing

Input Normalization

API Reference

Equality

Contains

StartsWith/EndsWith

IndexOf/Replace

Null/Empty Checks

Truncation

All methods are null-safe - they return false or null when the input string is null instead of throwing.