Race # in API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewDev2024
    Junior Member
    • Feb 2024
    • 3

    #1

    Race # in API

    Hey team,
    I'm having trouble getting the race number for some races ( a lot of overseas / outside Australia). Is there something simple I'm missing?
    Cheers,
  • Bascoe
    Member
    • Sep 2018
    • 42

    #2
    Well I wrote a custom function:

    Code:
    Public Function RaceNumberString(RaceString As String)
    
        Dim RaceNumber As String = ""
        Dim myChars() As Char = RaceString.ToCharArray()
        For Each ch As Char In myChars
            If Char.IsDigit(ch) Then
                RaceNumber = RaceNumber & ch
            End If
        Next
        Return RaceNumber
    End Function​
    then:

    Code:
    dtRow("RaceNumber") = RaceNumberString(Microsoft.VisualBasic.Left(BetBot.olstHorseMarkets(i).MarketName, 3))

    Comment

    • jabe
      Senior Member
      • Dec 2014
      • 705

      #3
      There's a string split function you might find useful (in future, your solution looks fine). It will divide a string up into an array of separate "words". You tell it what character to split the string on; often that will be a space.

      So, for instance, something like this:

      dim raceString = "31 Big Fast Oz Race 3pm-ish or whenever"
      dim outString() as string
      t = raceString.split(" ")

      resulting in

      t(0) = "31"
      t(1) = "Big"
      t(2) = "Fast"
      etc

      As long as you're sure the "word" you want will always be in the same place, it'll work. My program that I've just checked for its use uses it to break up a string of three-character country codes (IRE, RSA, FRA, USA, NZL, etc) that Betfair uses and which I put in a text file many years ago with a tilde ~ as the delimiter.
      Last edited by jabe; 22-02-2024, 01:49 PM.

      Comment

      • NewDev2024
        Junior Member
        • Feb 2024
        • 3

        #4
        Thanks everyone, do you guys also use any data matching functions?

        Comment

        Working...
        X