Showing posts with label Regular Expressions. Show all posts
Showing posts with label Regular Expressions. Show all posts

Friday, July 15, 2011

Validation Class For String

Extension method is introduced by Microsoft in .Net 3.5. With help of extension method, developer can extend any class without change in original source code. Extension methods are static methods that can appear to be part of a class without actually being in the source code for the class. So extension method is one of the richest feature of .net 3.5.

Here I create class for string validation which extends string class. With help of bellow class we can validate some regular string validation like email, password , numeric etc. It provide facility to validate your own custom regular expression.

Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

Tuesday, June 21, 2011

Some Amazing Fact About JavaScript


At once weird and yet beautiful, it is surely the programming language that Pablo Picasso would have invented. This post about some secrets and amazing fact of JavaScript.This facts and secretes helps to developers who are curious about
more advanced JavaScript. It is a collection of JavaScript’s oddities and well-kept secrets. I am going to prove you that every each of them can be explained.
  • Data Types And Definitions

    • Null is an Object

      Null is apparently an object, which, as far as contradictions go, is right up there with the best of them. Null? An object? “Surely, the definition of null is the total absence of meaningful value,” you say. You’d be right. But that’s the way it is. Here’s the proof:
      alert(typeof null);  //alerts 'object'
      Despite this, null is not considered an instance of an object. (In case you didn’t know, values in JavaScript are instances of base objects. So, every number is an instance of the Number object, every object is an instance of the Object object, and so on.) This brings us back to sanity, because if null is the absence of value, then it obviously can’t be an instance of anything. Hence, the following evaluates to false:
      alert(null instanceof Object);  //evaluates false