how to extract number from a string ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to extract number from a string ?

hello guys i have a string "A1224,B1224,C1234|A184,B1244,C144|" the numbers between alphabets varies from 1 to 4 digits and the string is recieved by bluetooth i want to extract number and save them in different three variables the string is updating after every 0.5 sec

15th Oct 2019, 10:16 PM
Muhammad Asfandyar
Muhammad Asfandyar - avatar
2 Answers
0
https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String) use regex to determine non alphabet. then replace it with empty string ""
15th Oct 2019, 11:50 PM
Taste
Taste - avatar
0
Martin Taylor I tried it but not get the actual result
16th Oct 2019, 10:47 AM
Muhammad Asfandyar
Muhammad Asfandyar - avatar