How to split a string in format AB123 --> AB 123? Java

Mac :

I have a string in format AB123. I want to split it between the AB and 123 so AB123 becomes AB 123. The contents of the string can differ but the format stays the same. Is there a way to do this?

belka :

Following up with the latest information you provided (2 letters then 3 numbers):

myString.subString(0, 2) + " " + myString.subString(2)

What this does: you split your input string myString at the 2nd character and append a space at this position.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=308396&siteId=1