Search Results

Search found 1 results on 1 pages for 'chengying'.

Page 1/1 | 1 

  • How to use a regular expression and assign the result to variables in Android?

    - by ChengYing
    I have a string named s_Result which will be parsed from the Internet. The format may be "Distance: 2.8km (about 9 mins)", and there are 4 variables which are f_Distance, m_DistanceUnit, f_timeEst, m_timeEstUnit. My question is how to parse s_Result and assign 2.8, km, 9, mins into f_Distance, m_distanceUnit, f_timeEst and m_timeEstUnit respectively using regular expression? I tried using "\d+(\.\d+)?" in RegEx Tester and the result showed 2 matches found, but if I use "\\d+(\\.\\d+)?" in Android code, it showed no matches! Any suggestions what might be going wrong?

    Read the article

1