< Summary

Information
Class: MyNet.Text.TextCasing.TitleCasingTransform
Assembly: MyNet.Text
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Text/TextCasing/TitleCasingTransform.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 36
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
Apply(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Text/TextCasing/TitleCasingTransform.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="TitleCasingTransform.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Globalization;
 9
 10namespace MyNet.Text.TextCasing;
 11
 12/// <summary>
 13/// Transforms a string to title case, meaning the first letter of each word is capitalized and the rest are lowercase. 
 14/// </summary>
 15public sealed class TitleCasingTransform : ITextCasingTransform
 16{
 17    /// <summary>
 18    /// Initializes a new instance of the <see cref="TitleCasingTransform"/> class.
 19    /// </summary>
 620    internal TitleCasingTransform() { }
 21
 22    /// <summary>
 23    /// Transforms the input string to title case. Each word's first letter is capitalized and the rest are lowercase, e
 24    /// </summary>
 25    /// <param name="input">The string to transform.</param>
 26    /// <param name="culture">The culture to use for the transformation.</param>
 27    /// <returns>The transformed string in title case.</returns>
 28    public string Apply(string input, CultureInfo culture)
 29    {
 6330        ArgumentNullException.ThrowIfNull(input);
 6331        ArgumentNullException.ThrowIfNull(culture);
 32
 6333        return culture.TextInfo.ToTitleCase(input);
 34    }
 35}
 36