remove last letter in a string
BlitzMax Forums/BlitzMax Beginners Area/remove last letter in a string
| ||
how do i remove the last letter in a string? |
| ||
newString = Left(oldString, Len(oldString)-1) |
| ||
and the less retro way would be..newString = oldString[..oldString.length - 2] (this assumes the string is long enough, of course...) |
| ||
(this assumes the string is long enough, of course...) newString = oldString[..Max(0,oldString.length - 1)] Fail safe! Oh, and I think you only need to subtract 1. ;-) |
| ||
Well, wha'ya know... and there was me thinking it was 0..length-1 based.... far, far too many hours in Java it seems. ;-) |