Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to format a text in blazor

$
0
0

Hi guys I'm creating a new project in blazor and I'm trying to format a text before using in in my html, the way i'm trying to do it is by using a replace, my main problem is that i can add a break line

this is the function that I'm using

public string gLInjectionStatusFormattedText (string? rawText) {        var text = rawText?.Replace("- Valve:", "\n Valve:")            .Replace("{CompletionAnalysisResults.troubleshooting_data.cont_gaslift_cmpl_inject_status.ref_data.current_op_valve_description}", "Weatherford RO-1 5/32 (THC)")            .Replace("- Mandrel number:", "\n Mandrel number:")            .Replace("{CompletionAnalysisResults.troubleshooting_data.cont_gaslift_cmpl_inject_status.ref_data.current_op_valve_mand_num}", "8")            .Replace("- Meas Depth:", "\n Meas Depth:")            .Replace("{CompletionAnalysisResults.troubleshooting_data.cont_gaslift_cmpl_inject_status.ref_data.current_op_valve_depth}", "4833.0 feet")            .Replace("{CompletionAnalysisResults.troubleshooting_data.cont_gaslift_cmpl_inject_status.ref_data.valve_status_summary}", "The deepest possible injection depth for this well is 4833.0 feet (MD) at current operating conditions.")            .Replace("Valve Status Summary:", "Valve Status Summary:");        return text ?? "";    }

and I'm using it in the html (blazor) like this

<div Class="d-flex flex-column gap-4"><div Class="d-flex  gap-4">        @getSummaryStatusColor(summaryStatus.GLInjectionStatus)<div>GL Injection Status:</div></div><p>@gLInjectionStatusFormattedText(summaryStatus.GLInjectionText)</p>                           </div>

where summaryStatus.GLInjectionText is a string that i get from a db

I would like my text to look like this

This well is injecting at its designed operating point:Valve: Weatherford RO-1 5/32 (THC)Mandrel number: 6Meas Depth: 4833.0 feet  Valve Status Summary: The deepest possible injection depth for this well is 4833.0 feet (MD) at current operating conditions.Lift gas injection is from an ORIF valve in mandrel number 6 at 4833.0 feet and has an estimated flow rate of 453.292 MCF/day.

But Instead of that in my html appears like this:

This well is injecting at its designed operating point: Valve: Weatherford RO-1 5/32 (THC) Mandrel number: 8 Meas Depth: 4833.0 feet &nbsp; Valve Status Summary: The deepest possible injection depth for this well is 4833.0 feet (MD) at current operating conditions.

Is there any way i can achieve this?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>