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

Status
Not open for further replies.

*GandaBerunda*

Drool!...Vista
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

The Mighty Unkel!!!
Staff member
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

Commander in Chief
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

The Mighty Unkel!!!
Staff member
I think there is no problem with the speed of the Split function, cause its a inbuilt method...
 
Status
Not open for further replies.
Top Bottom