Split command

Hello,
I am not able to use the split command for to fetch parcels H: m: s
The idea is to increase or decrease the area of minutes and get back to the textfield
the entire content.
Hot can teach me?

Thanks,
Rui

  ra=TextField3.Text     //coordinates  [21:21:21, +22:11:11]
  min=split(ra,":")           //take a minutes  21:[21]:21, +22:11:11

  ???

min=Val(min)+5    //more 5 min every time I press the button
  If min>60 Then
    min=60
  End if
  TextField3.Text=Str(cup)
  TextField3.Refresh
  

Split() returns an Array, so your result on line 2 - if min is properly declared as Dim min() As String - would look something like:
min(0) is [21
min(1) is 21
min(2) is 21, +22
min(3) is 11
min(4) is 11]

It appears that you are actually looking for the functionality of the Mid() function. Take a look at the documentation for Mid() in the Language Reference.

You can also use NthField

min=ra.NthField(":",2)

This is assuming that ‘min’ is defined as a string (which I’m not sure since you are also setting min to the calculated result)

Thanks to all for the advice. Learned better with NthField () function and could apply in my app.
I leave here a picture to see what they wanted with my request .

Rui


  //Cursor UP
  ra=NthField(TextField3.Text,",",1)                           //pick the AR [21:21:21], +22:11:11
  dec=NthField(TextField3.Text,",",2)                        //pick the DEC 21:21:21, [+22:11:11]
  hoursa=NthField(dec,":",1)                                        //pick the hours 21:21:21, [+22]:11:11
  minutesa=NthField(TextField3.Text,":",4)            //pick the minutes 21:21:21, +22:[11]:11
  secondsa=NthField(TextField3.Text,":",5)            //pick the seconds 21:21:21, +22:11:[11]
  
  up=val(minutesa) +2                                                   //+ 2 min every time press the button
  
  If up>60 Then
    up=60
  End if
  
  TextField3.Text= ra + "," + hoursa + ":" + str(up) + ":" + secondsa
  TextField3.Refresh
  

Remember that minutes only go to 59, not 60, so change that 60 to 59 and roll over:

If up > 59 Then
up = 0
End If

thanks TIm :slight_smile: