Showing posts with label Proper Case Function. Show all posts
Showing posts with label Proper Case Function. Show all posts

Monday, August 10, 2009

PadRight Function

CREATE FUNCTION dbo.PadRight


(@String varchar(100), --Input string to be padded


 @Length int,          --Length of final string


 @PadChar char(1)      --Padding character)


RETURNS varchar(100)


AS


BEGIN
WHILE LEN(@String + 'z') <= @Length


        SET @String = @String + @PadChar


RETURN @String


END

Convert a string to Proper Case

Convert a string to Proper Case
===========================

// Use this Namespace
using System.Globalization;

// Code
string myString = "thIS is tHE sAmple tExt to shoW tHIs examPle !!";

TextInfo TI = new CultureInfo("en-US",false).TextInfo;

Response.Write (TI.ToTitleCase( myString ));