Click here to Skip to main content
15,903,792 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a string value like this "014L" and I want to trim it in a different values like this
014
L

What I have tried:

I have tried split substr and trim methods but I couldn't .
Posted
Updated 17-Mar-23 4:28am

Try a regex:
RegEx
^(\d+)([^\d]+)$
Will split it into number and non-number groups in the match.
 
Share this answer
 
This will do it:
Java
String data = "014L";
System.out.println(data.substring(0, 3));
System.out.println(data.substring(3));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900