C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » General »

String Functions In VB.NET


Posted Date: 05 Nov 2009    Resource Type: Articles    Category: General
Author: Abhisek PandaMember Level: Gold    
Rating: 1 out of 5Points: 10



String Functions In VB.NET



Some of the String Handling functions in VB.NET are follows,

Len(String):- This function returns an integer containing the number of characters in the specifies string including spaces or no. of bytes required to store the variable.

Dim Str As String,Len As Integer
Str="Welcome"
Len=Len(Str)'returns 7

Space(int):- It returns a string containing the specified nmber of spaces.

Dim Str As String
Str=Space(5)'return a string with 5 spaces.
Str="Hello"&Space(5)&"INDIA" 'it will add 5 spaces between two strings.

LCase(String):- This function translates all upper case characters in a string to lower case.

Dim Str,LStr As String
Str="Welcome"
LStr=LCase(Str)'returns "welcome"

UCase(String):-This function translates all lower case characters in a string to upper case.

Dim Str,LStr As String
Str="Welcome"
LStr=LCase(Str)'returns "WELCOME"

RTrim(String):- It returns a string after removing trailing spaces from a string.
LTrim(String):- It returns a string after removing leading spaces from a string.
Trim(String):- It returns a string after removing trailing as well as leading spaces from a string.

Dim Str,tStr As String
Str=" Welcome "
tStr=Trim(Str)'returns "Welcome"
tStr=RTrim(Str)'returns " Welcome"
tStr=LTrim(Str)'returns "Welcome "
tStr=RTrim(LTrim(Str))'returns "Welcome" same function as Trim()

StrReverse(String):- This function reverse the specified string.

Dim Str,RStr As String
Str="Welcome"
RStr=StrReverse(Str)'returns"emocleW"

StrComp(String1,Strins2,[Compare]):- This function is used to compare two string for there values. Here compare is an optional argument that specifies type of comparision.

Asc(String):- It returns an integer representing the ASCII code corresponding to the first letter of the specified string.

Dim no As Integer
no=Asc("A")'returns 65
no=Asc("a")'returns 97
no=Asc("Microsoft")'returns 77

Chr(Int):- This function takes the ASCII character code as argument and returns the character corresponding to the code.

Dim Ch As String
Ch=Char(65)'returns "A"
Ch=Char(97)'returns "a"
Ch=Char(77)'returns "M"

There are also many more string functions in VB.NET, but these are frequently used functions.






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
String Functions In VB.NET  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Five ways to speed up your PC
Previous Resource: Numeric and Date Functions in VB.NET
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use