Culture sensitive string.Contains()
This will provide an Extension Method to enable you to perform a safer contains search within a string.
For projects built on framework v2.0, make sure you include:
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
| AttributeTargets.Method)]
public sealed class ExtensionAttribute : Attribute
{
public ExtensionAttribute() { }
}
}
Here’s the method:
public static bool Contains(this string searchWithin,
string value, StringComparison comparisonOptions)
{
if (value.Length == 0)
{
return true;
}
for (int i = 0; i < (searchWithin.Length - value.Length); i++)
{
if (searchWithin.Substring(i, value.Length).Equals(value, comparisonOptions))
{
return true;
}
}
return false;
}
something.Contains(somethingElse, StringComparison.CurrentCultureIgnoreCase);
See here http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/ebc4258ed2c4270f/c48b6c15df01e8bf?pli=1 for more information on the issue.
Wednesday Sep 22nd
Your guide to managing, improving and marketing UK public sector websites
If working in or for the public sector this might be of interest:
“Compliance with industry standards is an important measure of website quality. COI has issued a series of web standards and guidelines that government websites should follow. This section summarises the key requirements.”
Web standards and guidelines
http://coi.gov.uk/guidance.php?page=188
Measuring website quality
http://coi.gov.uk/guidance.php?page=144
Wednesday Sep 22nd
Are you a .Net developer and want to work for full service agency in Shoreditch?
My previous employer, Precedent are looking for a new .Net developer, check out the job description in the pdf below:
http://public.restlessmedia.com/docs/DeveloperNet-NetDevPrecedentLon.pdf
Precedent are a full service agency developing sites & iPhone applications for many top clients using .Net, php and the latest front-end technologies.
Get in touch with Keith Patton @ Precedent for more information:
Ph: 020 7426 8939
Mob: 079 8408 2932
Email: keith.patton@precedent.co.uk
Tuesday Sep 21st
Disqus comment system
Whilst reading up on the latest at the excellent mashable.com I noticed their comments system is powered by disqus.com… So I thought, what’s good enough for them, is good enough for me.
Just need to get into the approval process so I can order via remove the viagra spam.
Saturday Sep 4th