Getting a specific data from the string received

34 views
Skip to first unread message

Sangamithra Senthil

unread,
Aug 25, 2020, 1:21:38 AM8/25/20
to Flutter Development (flutter-dev)
Greeting.
I'm new to flutter. I need to create an App in which one of the operation is to receive SMS and need to display the data in the app.
For example, if I receive 

" POWER BACK
3PHASE SUPPLY
AUTOMODE ON
RY: 425 
YB: 425 
BR: 430 
SIGNAL: 033 "
Here, only numbers  will be differs from each SMS i receive. I need to get only the numbers to be displayed in my app. Like : to display - 1.425  2.425  3.430 4. 033
My question is how to get only numbers from this received SMS?

harivamshi diddiga

unread,
Aug 25, 2020, 1:44:07 AM8/25/20
to Sangamithra Senthil, Flutter Development (flutter-dev)
https://rrtutors.com/tutorials/Read-Inbox-Messages-Flutter-SMS-Retriever

this might help. after retrieving the messages do some regex matching to retrieving all numbers.
FROM...
D. Harivamshi



--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/20dac68e-a037-4412-ad22-48aff542e4cfn%40googlegroups.com.

dickinso...@gmail.com

unread,
Aug 25, 2020, 3:05:11 AM8/25/20
to Flutter Development (flutter-dev)
Have a look at this Medium post that shows several options to address your problem. https://medium.com/flutter-community/exploring-string-methods-in-dart-324f747b8d15
Personally I would look at using the toSet() method to 'subtract' the characters in the sms that are always the same and then split the 4 sets of digits, that remain, into separate variables. 

dickinso...@gmail.com

unread,
Aug 25, 2020, 3:10:49 AM8/25/20
to Flutter Development (flutter-dev)
Or allMatches 

Sangamithra Senthil

unread,
Aug 25, 2020, 5:43:02 AM8/25/20
to Flutter Development (flutter-dev)
Thanks for the reply sir,  I'm new to flutter so I don't know how to use toSet() method can you  
give me some example codes on how to subtract the code...! 
Reply all
Reply to author
Forward
0 new messages