MatchCase
Contents
[
Hide
]FindReplaceOptions.MatchCase property
True indicates case-sensitive comparison, false indicates case-insensitive comparison.
public bool MatchCase { get; set; }
Examples
Shows how to toggle case sensitivity when performing a find-and-replace operation.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Ruby bought a ruby necklace.");
// We can use a "FindReplaceOptions" object to modify the find-and-replace process.
FindReplaceOptions options = new FindReplaceOptions();
// Set the "MatchCase" flag to "true" to apply case sensitivity while finding strings to replace.
// Set the "MatchCase" flag to "false" to ignore character case while searching for text to replace.
options.MatchCase = matchCase;
doc.Range.Replace("Ruby", "Jade", options);
Assert.AreEqual(matchCase ? "Jade bought a ruby necklace." : "Jade bought a Jade necklace.",
doc.GetText().Trim());
See Also
- class FindReplaceOptions
- namespace Aspose.Words.Replacing
- assembly Aspose.Words