B4R Question How do I cut a String or A value

pokhraj_d

Member
Hello All,
I required to get the last two digit of any value.
Like :
Degree=3051

I want 51 only.
How Do I cut and get the value of 51? I am able to get each digit of 3051 , but not the last two digit.

Below is the code:
Code: Copy
Public Serial1 As Serial
    Private b() As Byte="3051"
    Private bc As ByteConverter
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
Dim i As Int=0
For i = 0 To b.Length-1
    Dim c() As Byte=bc.SubString2(b,i,i+1)
    Log(c)
Next
End Sub

Thanks-
Pokhraj
 
Done.... Result is coming as expected.

Below is the code:

Code: Copy
Public Serial1 As Serial
    Private b() As Byte= "088226677" '"08822"    '"3051"
    Private bc As ByteConverter
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
       Dim d() As Byte=bc.SubString(b,(b.Length-2))
    Log(b.Length)
    Log(d)
End Sub

Thanks-
Pokhraj
 
Upvote 0

Similar Threads

  • Locked
  • Article Article
B4R Tutorial Strings and Bytes
Replies
8
Views
30K
  • Locked
  • Article Article
Replies
36
Views
57K
Back
Top