Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i am trying to convert the
02.01.15.0008 to 2.1.1.5.8 
but wasnt succesful .I was trying Trim and TrimStart but didnt succeeed any
suggestion on this please


basically my conversion shoud be as follows:
02.01.15.0008 --> 2.1.15.8
02.02.01.0005 --> 2.2.1.5


What I have tried:

i have tried using trim and trim start

also tried
Dim lstrSIOSchemaVersion = cboConfig.Items(0)
                                        
lstrSIOSchemaVersion = lstrSIOSchemaVersion.Replace("0", String.Empty)


it worked but thinking if there is a better way
Posted
Updated 2-Nov-20 2:12am
v4

Use the Version Class[^]:
VB.NET
Dim lstrSIOSchemaVersion As String = cboConfig.Items(0)

Dim ver As Version
If Version.TryParse(lstrSIOSchemaVersion, ver) Then
    lstrSIOSchemaVersion = ver.ToString()
End If
 
Share this answer
 
Simplest would be to use Strings.Split[^], convert the array to integer, and then Strings.Join[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900