02-10-2018, 06:44 PM
(02-09-2018, 01:03 AM)Ankur Wrote: This is a good question.Wow!!!
I am sure there can be multiple way to solve this. Here is one of the solutions I created for you. You just need to call ALL the delimiters you use in the string and the custom SplitExtended function will do the rest.
Essentially I am using the built in Replace function to run n times where n is the number of delimiters you supply in the array.
Code:Function SplitExtended (sPhraseFn, aDelimiters)
'Find total number of delimiters. Remember ubound starts from 0 index
iNoOfDelimiters = UBound(aDelimiters)
'Replace all your delimiters with space
For Iterator = 0 To iNoOfDelimiters
sPhraseFn = Replace (sPhraseFn, aDelimiters(Iterator)," ")
Next
SplitExtended = sPhraseFn
End Function
sPhrase = "My?name/isNandha-welcome^"
sPhraseClean = SplitExtended(sPhrase, Array("?","/","-","^"))
msgbox sPhraseClean
thanks alot Ankur..