Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Occurs in C#
Message
From
26/02/2013 12:56:18
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01566946
Message ID:
01566947
Views:
65
This message has been marked as a message which has helped to the initial question of the thread.
>Just wondering if occurs should be implemented the same way as in SQL Server?

Not the fanciest, but it does the job:
        ' Count the occurences of one string within another
        ' expC1 Character to look for
        ' expC2 String
        Public Function Occurs(ByVal tcCharacter As String, ByVal tcString As String) As Integer
            Dim lcString As String = ""
            Dim lnCount As Integer = 0
            Dim lnLocation As Integer = 0

            lcString = tcString

            Do
                lnLocation = lcString.IndexOf(tcCharacter, lnLocation)

                If lnLocation < 0 Then
                    Exit Do
                Else
                    lnCount = lnCount + 1
                    lnLocation = lnLocation + 1
                End If

            Loop While True

            Return lnCount
        End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform