Sam:
Everything in the code I gave you is explicitely declared....I'm making use of three variables "originalString" , "aBlock" and "bBlock" Option Explicit is automatically turned on in VB.Net
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
It's mean aBlock is 2004 and bBlock is 12?
Yes, I want it split off, 2004 and 12 of 200412.
Do I need to declare something before originalString.Substring? Explicit Options?
Sam,
These questions are always hard to answer because we aren't 100% clear on how you want to split it. Will it always be the first 4 characters in the first block? Or will it always be the last 2 in the 2nd block? Or are they the same because the block will always be 6 characters?
Anyways, assuming it'll always be XXXXYY then I'd do:
Dim originalString As String = "200412"
Dim aBlock As String = originalString.Substring(0, 4)
Dim bBlock As String = originalString.Substring(4)
I prefer subString over left and right because it's more .net frameworkish (that is it'll work in C# as well)
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
I want to divide character into 2 section.
Example, 200412 divided into 2004 in A block and 12 in B block.
Please advise how to use left(string, length) or right(string, length) for above request.
Many thanks in advance.