William Duffy

Glasgow Based C# ASP.NET Web Developer

Tag archive for ‘Strings’

Modifing XML values in XSLT documents

Ever wondered how to perform manipulations of XML values in an XSLT document? For example, if you were consuming an RSS feed which had description values greater than 500 characters in length, but you only wanted to display the first 50 characters before leading the user through to the full post. The solution is XPath [...]

Parsing dates when ASP.NET’s DateTime.Parse doesn’t work

Has DateTime.Parse ever thrown the following exception when you passed it a legally formatted value, leaving you bemused as to why it can’t parse it? String was not recognized as a valid DateTime As powerful as DateTime.Parse is, it cannot handle every representation of a date/time value without a little help from you, the developer. [...]

Coalesce: ASP.NET Strings

In programming it is a common occurrence to have a list of possiblities from which you would like the first available option selected. SQL Server has a handy method (Coalesce) which makes performing this easy, but unless you are using nullable types .NET does not have a suitable alternative. Here, I will make a helper [...]