Tech Blog

FormatWithTags Extension Method

By: Chris Dunn on Tue Aug 14, 2018 (4 min read)

The string.format(..) method for building strings with variables is useful when you have a string template and want to replace values within the text. The only problem I have with this method is that it uses numeric placeholders for the values. That's fine if you have one or two values to integrate, but if you're dealing with more formatting of the text, it's problematic. string.Format("My name is {0} and I live in {1}.", "Chris", "Indiana");  Note: String interpolation will not work in this ca ...

StripHtml string extension

By: Chris Dunn on Tue Apr 10, 2018 (3 min read)

If you're working on a web project with customizable html content you will need, at some point, a way to strip the Html in order to access the raw text.   One scenario I use often is automatically generating an intro for a listing page for products, by using the html formatted product description.  I do this by cleaning the html out of the description, and then grabbing the first 255 characters to display.  In the case of extracting a preview or description of html text, I suggest you cache or p ...

Copyright 2023 Cidean, LLC. All rights reserved.

Proudly running Umbraco 7. This site is responsive with the help of Foundation 5.