DIGIT-ARC read-only archive · snapshot: July 23, 2026

how to extract the needed part from a string in vb.net

4 posts · originally from https://geek.digit.in/community/threads/how-to-extract-the-needed-part-from-a-string-in-vb-net.72283/

*GandaBerunda*
*GandaBerunda* Original post #1
Nov 2, 2007 at 8:30 PM
i a having a string Strg whose contents will be in the format ".yyy.zzzz" . I need to extract just the portion between the the two full stops in the string .ie. "yyy" to aanother string..how can i do this? here the length of the string can be anything..
RCuber
RCuber #2
Nov 5, 2007 at 4:01 AM
Use Split method in strings and retrive the data you want
ex code in your case will be.
Code:
Dim Strg as String = ".123.45678"
Dim Str() as String 
Str=Strg.Split(".")

Str is a array which will contain you string. Str(0) will have "" , Str(1) will have 123 , and Str(2) will have 45678.
QwertyManiac
Nov 5, 2007 at 7:55 AM
Wont using an Extract-Until-Encounter-Dot (Starting with str[1]) method be much more faster here, since your string's pattern is definite?
RCuber
RCuber #4
Nov 5, 2007 at 1:05 PM
I think there is no problem with the speed of the Split function, cause its a inbuilt method...