| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="TextPipeline.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System.Globalization; |
| | | 8 | | |
| | | 9 | | namespace MyNet.Text; |
| | | 10 | | |
| | | 11 | | /// <summary> |
| | | 12 | | /// A pipeline for applying multiple text transformations in sequence. This class allows you to chain multiple transform |
| | | 13 | | /// </summary> |
| | | 14 | | /// <param name="value">The initial string value for the pipeline.</param> |
| | | 15 | | /// <param name="culture">The culture to use for culture-specific transformations.</param> |
| | | 16 | | public sealed class TextPipeline(string value, CultureInfo culture) |
| | | 17 | | { |
| | | 18 | | /// <summary> |
| | | 19 | | /// Gets the current value of the text after applying transformations. This property holds the result of the transfo |
| | | 20 | | /// </summary> |
| | | 21 | | public string Value { get; private set; } = value; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Applies a text transformation to the current value in the pipeline. This method takes an implementation of the I |
| | | 25 | | /// </summary> |
| | | 26 | | /// <param name="transform">The text transformation to apply.</param> |
| | | 27 | | /// <returns>The TextPipeline instance with the applied transformation.</returns> |
| | | 28 | | public TextPipeline Apply(ITextTransform transform) |
| | | 29 | | { |
| | 36 | 30 | | Value = transform.Apply(Value, culture); |
| | 36 | 31 | | return this; |
| | | 32 | | } |
| | | 33 | | } |
| | | 34 | | |