B4R Question little problem with bytearray... [solved]

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
Hi, for incoming udp_packets, i start with a loop to seperate the content, for instance content: "ambient:1000:100:20:60:30:50:5:17:4". Want to seperate first word as 'order' with:


B4X:
Dim NOP As Byte ' Number of Points
Dim order() As Byte

    For Each s() As Byte In bc.Split(Buffer, ":")                'count ":"
        NOP = NOP + 1
        If NOP = 1 Then
            order = s
            Log("order1 : ", order)                                        ' here, 'order' is "ambient"
        End If

        Log(NOP," : ", bc.StringFromBytes(s))
        Log("order2 : ", order)                                           ' here, 'order' is "ambient" when NOP = 1
    Next
 
   Log("order3 : ", order)                                              ' here, 'order' is "" - empty


... why is it lost?

thanks:)



.... ok, needed to use bc.arraycopy .....
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Can't you use bc.Split?

 
Upvote 0

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
Can't you use bc.Split?

Yes, thank you Erel. It's in line 4. Works fine now. Arraycopied s() to defined bytearrays and can send them to subroutines. Very transparent. Have a good time. Will there be a b4h for New Huawei OS? ?
 
Upvote 0
Top