Extract numbers from String Array

后端 未结 4 401
孤独总比滥情好
孤独总比滥情好 2021-01-24 03:18

I have a Array of Strings

scala> tokens
res34: Array[String] = Array(The, value, of, your, profile, is, 234.2., You, have, potential, to, gain, 8.3, more.)
         


        
4条回答
  •  深忆病人
    2021-01-24 03:28

    With Regex, you can use this code to catch all the numbers:

    \d+\.?\d+
    

    Demo: https://regex101.com/r/pZomjn/1

提交回复
热议问题