![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
Public Shared Function LeftB()Function LeftB(ByVal nTarget As String, ByVal iByteSize As Integer) As String
Return MidB(nTarget, 1, iByteSize)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
Public Shared Function MidB()Function MidB(ByVal nTarget As String, ByVal iStart As Integer) As String
Dim hEncoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("Shift_JIS")
Dim bBytes As Byte() = hEncoding.GetBytes(nTarget)
Return hEncoding.GetString(bBytes, iStart - 1, bBytes.Length - iStart + 1)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
Public Shared Function MidB()Function MidB(ByVal nTarget As String, ByVal iStart As Integer, ByVal iByteSize As Integer) As String
Dim hEncoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("Shift_JIS")
Dim bBytes As Byte() = hEncoding.GetBytes(nTarget)
Return hEncoding.GetString(bBytes, iStart - 1, iByteSize)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
Public Shared Function RightB()Function RightB(ByVal nTarget As String, ByVal iByteSize As Integer) As String
Dim hEncoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("Shift_JIS")
Dim bBytes As Byte() = hEncoding.GetBytes(nTarget)
Return hEncoding.GetString(bBytes, bBytes.Length - iByteSize, iByteSize)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)