VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Break a set of strings separated by a single space into the individual strings combined.

by Samuelanre (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sat 3rd May 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Break a set of strings separated by a single space into the individual strings combined.

Rate Break a set of strings separated by a single space into the individual strings combined.



'by a single space into the individual strings combined.
'An example is when you have combined surname, firstname, 
'and lastname into a single string separated by a single space, but now
'you want to break them apart again.

'VERY USEFUL WHEN WORKING WITH A DATABASE WHERE THE NEED MAY ARISE
' TO COMBINED DIFFERENT STRINGS, WHICH HAS TO BE SPLIT AGAIN (FOR THE 
' PURPOSE OF UPDATING THE INDIVIDUAL STRING BACK TO THE DATABASE
' YOU CAN CONTACT ME FOR FURTHER CLARIFICATION ([email protected])

'Example:
'surname=strSName, firstname=strFname,MiddleName=strMname
Dim strSName as String, strFname as String, strMname as String, br1 As String

'theString is the combined string

strSName = Mid(theString, 1, InStr(1, theString, " "))
br1 = Mid(theString, Len(strSName) + 1, Len(theString) - Len(strSName))
strFname = Mid(br1, 1, InStr(1, br1, " "))
strMname = Mid(br1, Len(strFname) + 1, Len(br1) - Len(strFname))


Download this snippet    Add to My Saved Code

Break a set of strings separated by a single space into the individual strings combined. Comments

No comments have been posted about Break a set of strings separated by a single space into the individual strings combined.. Why not be the first to post a comment about Break a set of strings separated by a single space into the individual strings combined..

Post your comment

Subject:
Message:
0/1000 characters