Friday, November 21, 2008 Home RegisterLogin
Menu
 
Counter
 
Tomasz Modelski IT site
86_115_web.jpg

My name is Tomasz Modelski.
This is my website about IT & my proffesional interests.
If you're looking for my CV / resume, please go
here.
Main topics of this site are : .Net, web development, software architecture, frameworks, BizTalk Server, project management, DotNetNuke, ...... .

I'm also owner of 'IDev Tomasz Modelski' company.

 
My blog
Aug7

Written by:Tomasz Modelski
2008-08-07 13:06:05Z

I've encountered some very little small issue - string should not be longer that a certain number.
Substring method [ s.Substring(0,number) ] raises exception when string lenght is lesser than above number.

So small thing and additional code is required. 
The best solution that come to my mind is to write extension method to string class.

Google .. and I've found it on Codeplex:
dotNetExt - .NET Extension Method Library

It has method Left(number) - I needed exactly such.
Another nice thing is that methods are well writen and deals nicly with nulls string, so :
string s=null;
string s1=s.Left(10);

executes without exception 'Object reference .... ' and s1=null.

Nice. This's beta, looking forward for release version.

Tags:

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel  
 
MCP-RGB-smaller.gif

Quick links
 
Whats New?
 
Partners
 
Copyright 2008 by Tomasz ModelskiTerms Of UsePrivacy Statement