C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




String Spliter Function


Posted Date: 19 Jul 2007    Resource Type: Articles    Category: .NET Framework

Posted By: Cema Indumathy V       Member Level: Diamond
Rating:     Points: 10




For example if you are having the strings like "34124 123434 12341241 1234124 213412 12 1234 234 1234 1234 1234". Here the delimiter for each set of numbers is space. So by using the following function you can split each set of values.
This function need the following parameters:

1.String which contains the set of values. It should be passed by value. (psRecord)
2.Object which going to hold the set of values seperately. It should be passed by value. (newstart)
3.Demiliter String which means the any character that you want to mark it as a delimiter.It should be passed by value. (delimiter)

Function StringSpliter(ByVal psRecord As String,ByRef newstart as Object, ByVal delimiter as string)
Dim liLength, liStart, liUpto, liCounti, liCountj As Integer

Dim licount, liLength, piCount As Integer

liLength = Len(psRecord)
piCount = 0
For licount = 1 To liLength
If Mid(psRecord, licount, 1) = " " Then
piCount = piCount + 1
End If
Next


newstart=""
ReDim newstart(piCount)
liLength = Len(psRecord)
liCountj = 0
For liCounti = 1 To liLength
If Mid(psRecord, liCounti, 1) = delimiter Then
liStart = liCounti
If liCountj = 0 Then
newstart(liCountj) = Mid(psRecord, 1, liStart - 1)
liUpto = liCounti + 1
Else
newstart(liCountj) = Mid(psRecord, liUpto, liStart - liUpto)
liUpto = liCounti + 1
End If
liCountj = liCountj + 1
ElseIf liCountj = piCount Then
liUpto = liCounti
newstart(liCountj) = Mid(psRecord, liUpto)

Exit For
End If
Next
End Function




Responses

Author: Ganesh    20 Jul 2007Member Level: Bronze   Points : 0
Though Logic is good, Split function exists in C#.

Check this link which explains the split function

http://www.peachpit.com/articles/article.asp?p=31938&seqNum=14&rl=1


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

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: Modeling of a Rating application by applying Generics in C#2.0
Previous Resource: How to Maximize a page everytime it gets executed through javascript
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use