davepamn Active Member Licensed User Longtime User Apr 15, 2016 #1 This Code snippet does not work Code: if sb.length>0 then sb.Remove(sb.length-1,1) end if I want to remove that last character of the string I had to write a more verbose solution Code: Dim sNumber As String If sb.Length>0 Then sNumber=sb.toString sNumber = sNumber.SubString2(0, sNumber.Length -1) sb.Remove(0,sb.Length) sb.Append(sNumber) End If Last edited: Apr 15, 2016
This Code snippet does not work Code: if sb.length>0 then sb.Remove(sb.length-1,1) end if I want to remove that last character of the string I had to write a more verbose solution Code: Dim sNumber As String If sb.Length>0 Then sNumber=sb.toString sNumber = sNumber.SubString2(0, sNumber.Length -1) sb.Remove(0,sb.Length) sb.Append(sNumber) End If
mc73 Well-Known Member Licensed User Longtime User Apr 15, 2016 #2 Tried Code: sb.remove(sb.length-1,sb.length) ? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 17, 2016 #3 As mc73 suggests, the second parameter is the ending index. It is not the number of characters that will be removed. Upvote 0
As mc73 suggests, the second parameter is the ending index. It is not the number of characters that will be removed.