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



## *GandaBerunda* (Nov 2, 2007)

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 (Nov 5, 2007)

Use Split method in strings and retrive the data you want 
ex code in your case will be.

```
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)

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 (Nov 5, 2007)

I think there is no problem with the speed of the Split function, cause its a inbuilt method...


----------

