P pokhraj_d Member Oct 28, 2018 #1 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
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
P pokhraj_d Member Oct 28, 2018 #2 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
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