Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Bonsai Trees

Liquid Web Managed Dedicated Server: RAID 1 SSD with 16GB of RAM minimum! 24/7 On-Site Heroic Support! Industry-Leading SLA!

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Liquid Web Cloud VPS Hosting

8,990 questions

12,404 answers

573 users

How to sum all numbers from a string in VB.NET

1 Answer

0 votes
Imports System.Text.RegularExpressions

Module Module1

    Sub Main()

        Dim s As String = "1 VB.NET 13 Java 89 Python 99 C 4"
        Dim total As Integer = 0

        Dim mcollection As MatchCollection = Regex.Matches(s, "\d+")

        For Each mc As Match In mcollection
            total += Convert.ToInt32(mc.ToString())
        Next

        Console.WriteLine(total)

    End Sub

End Module


' run:
' 
' 206

 




answered Oct 6 by avibootz
...