VB => Java 移植 Android メモ 2022_01_12 VB ( Left , Chr() , Mid )

VB]

 strData = oEnc.GetString(byStatus, 0, intRecvSize)

If Left(strData, 1) <> Chr(3) Then

[ java ]

  // 0x03
 String Chr_3 = strData.substring(0,1);
 byte bx_03 = new byte[1];
 bx_03 = Chr_3.getBytes();

 // 比較用
 byte tx_03 = new byte[1];
 tx_03[0] = 0x03;


if (!(Arrays.equals(bx_03, tx_03))) {
   System.out.println("等しくない");
} else {
   System.out.println("等しい");
}

---------------------------------------------------------------------


[VB]

strData = Mid("2, 49, 48, 48, 48, 48, 49, 13,", 3)
Console.WriteLine (strData)


[ java ]

//=============================== VB Mid
String strData = "2, 49, 48, 48, 48, 48, 49, 13,";
String Midstr = strData.substring(2);
        
System.out.println(Midstr);