SIGN UP MEMBER LOGIN:    
ARTICLE

String Jargon in C#

Posted by Prasad Articles | C# Language September 05, 2001
The following article shows some String functions which are not currently available directly in C#.
Reader Level:
Download Files:
 

Description 

The following article shows some String functions which are not currently available directly in C#.
 
PCase
 
This will conver the string passed to ProperCase ie each word's first is changed to UpperCase().The word is identified using whitespace character such as " ","\t","\n","\r".

Usage: PCase(string)   
 
Replace
 
Currently in C# it does not support Replace() function for string even stringbuilder Replace() also does character replacement and not string replacement. This function will find the characters passed in the second argument with the source string in first argument and replace it with 3rd argument.
 
Usage: Replace(Source,Find,Replacement) 
eg. Replace("abc","b","d") will return "adc" 
 
ToSingleSpace

ToSingleSpace is a function which will trims off multiple whitespace characters to single whitespace characters.
   
Usage:ToSingleSpace(SourceString) 
eg.ToSingleSpace("Welcome    to     C#") will return "Welcome to C#" 
  
CharCount 
 
This CharCount will no. of occurrences of a sub string in the main string. This will be useful in parsing functions.

Usage:CharCount(Source,Find) 
eg.CharCount("aaaaac","a")  will return 5
 
Reverse

This will reverse the String argument passed and return it.

Usage:Reverse(Source) 
eg.Reverse("abc") will return "cba" 
 
Left 
 
This will returns certain no.of characters from the beginning of the string. 

Usage:Left(Source,CharCount) 
eg. Left("Welcome",3) will return "Wel" 
  
Right
 
This will return certain no.of characters from the end of the String.

Usage:Right(Source,CharCount)  
eg. Right("Welcome",2) will return "me" 
 
IsPalindrome
 
This function will return whether the passed string is palindrome or not.
 
Usage:IsPalindrome(Source)  
eg.IsPalindrome("abc") will return false wherease IsPalindrome("121") will return true.

Login to add your contents and source code to this article
share this article :
post comment
 

This article is obvously old and deserves to be update. I was looking for a replace function in c# at first I tried your replace function but as I look into msdn all I have to do is

string OldText = OldText.Replace("old","new");

your function works though.

Posted by Anthony Tsao Jul 12, 2006

given a string i want to print all the various possible combinations of the strings

in c# methods

Posted by kedarnadh sharma Feb 07, 2006
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Team Foundation Server Hosting
Become a Sponsor