Actualmente estoy en el proceso de eliminación de etiquetas html de campos dentro de una base de datos interna. Todo ha ido bien, excepto para convertir las etiquetas
en texto sin formato de los nuevos caracteres de línea.Parse <br> en texto sin formato nuevo párrafo
me gustaría convertir esto:
The victory halted Spain’s 35-game unbeaten streak, handing the Spanish their first defeat since November 2006. The Americans now advance to the final Sunday to face the winner of Thursday’s semifinal between South Africa and Brazil, the five-time World Cup winner. Brazil defeated the Americans, 3-0, in their earlier meeting in this tournament.<br>
<br>
In the final, though, the United States will be without midfielder Michael Bradley, who received a red card for a harsh tackle in the 87th minute, the third such ejection for the Americans in this tournament. It was the only careless blemish on an otherwise nearly perfect evening.
en esto:
The victory halted Spain’s 35-game unbeaten streak, handing the Spanish their first defeat since November 2006. The Americans now advance to the final Sunday to face the winner of Thursday’s semifinal between South Africa and Brazil, the five-time World Cup winner. Brazil defeated the Americans, 3-0, in their earlier meeting in this tournament.
In the final, though, the United States will be without midfielder Michael Bradley, who received a red card for a harsh tackle in the 87th minute, the third such ejection for the Americans in this tournament. It was the only careless blemish on an otherwise nearly perfect evening.
estoy usando la siguiente línea de código para cambiar el
a un carácter de nueva línea:
value = value.Replace("<br>", Environment.NewLine).Trim();
Después de ejecutar ese código esto es lo que se guarda en mi base de datos:
The victory halted Spain's 35-game unbeaten streak, handing the Spanish their first defeat since November 2006. The Americans now advance to the final Sunday to face the winner of Thursday's semifinal between South Africa and Brazil, the five-time World Cup winner. Brazil defeated the Americans, 3-0, in their earlier meeting in this tournament. In the final, though, the United States will be without midfielder Michael Bradley, who received a red card for a harsh tackle in the 87th minute, the third such ejection for the Americans in this tournament. It was the only careless blemish on an otherwise nearly perfect evening.
Si tomo el texto analizado guardado en mi base de datos y lo pego en el bloc de notas o Word obtengo solo un párrafo en lugar de dos.
¿Es esta la manera correcta de manejar esto? La base de datos que estoy usando es SQL Server 2005.
no puedo responder su pregunta, pero debo felicitarlo por lo bien que ha explicado y documentado lo que pregunta. Tantos n00bs se habrían detenido después del primer párrafo ... – jlarson
Si depura y rompe en la línea antes de guardarla en la base de datos, ¿ve 2 nuevos marcadores de línea en la cadena? – Tetraneutron
Gracias. Lo depuré y rompí antes y después del cambio. Cuando miro el texto en el depurador después de que el código se ejecuta para eliminar el
, aparece como debería, con dos párrafos. Después de esa línea, el valor se guarda. Luego ejecuté una consulta para extraer el valor de la base de datos y pegarlo en Word 2003 pero solo vi un párrafo. – Brownman98