String Jargon in C# zz
2007-07-17 21:07
323 查看
http://www.c-sharpcorner.com/UploadFile/prasad_1/StringJargonPSD12062005020601AM/StringJargonPSD.aspx
Description
The following article shows solinkme 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.
zip
Description
The following article shows solinkme 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.
zip
相关文章推荐
- Different ways how to escape an XML string in C# (zz)
- Replicate String in C#
- Writing Efficient String Functions in C#
- String formatting in C#
- C# int 转 16进制的字符串 in to hex string
- Best way to repeat a string/character n times in C#
- Numeric String Sort in C#
- String Formatting in C#
- How can I convert String to Int in C#?
- C# Tip: Placing Your C# Application in the System Tray(把应用程序最小化到系统托架中)(zz)
- String.Format in Java and C#
- c# - 反序列化报错:Input string was not in a correct format
- [JavaScript] Imitate String.Format() in c#
- Convert string to binary and binary to string in C#
- Different ways how to escape an XML string in C#
- csharp:Learn how to post JSON string to generic Handler using jQuery in ASP.Net C#.
- String Formatting in C#
- String.Format in Java and C#
- c# 使用 string.format 报错: input string was not in a correct format
- String Formatting in C#