Get the last three chars from any string - Java

前端 未结 11 1500
情话喂你
情话喂你 2020-12-24 10:21

I\'m trying to take the last three chracters of any string and save it as another String variable. I\'m having some tough time with my thought process.

Strin         


        
11条回答
  •  没有蜡笔的小新
    2020-12-24 11:12

    The getChars string method does not return a value, instead it dumps its result into your buffer (or destination) array. The index parameter describes the start offset in your destination array.

    Try this link for a more verbose description of the getChars method.

    I agree with the others on this, I think substring would be a better way to handle what you're trying to accomplish.

提交回复
热议问题