videring

1.scala判断字符串中是否有带数字

 array.filter(x => x.matches(".*\\d+.*"))

2.字符串中数字替换为空

 str.replaceAll("\\d+","")

3."FD-LTE_MRO_ERICSSON_OMC1_356296_20170317203000.xml.zip" => fd-lte_mro_ericsson_omc1

val regex =
"""^\d+$""".r
val elements = fileName.split("_", -1)

val filePrefixName = elements.takeWhile {
regex.findFirstMatchIn(_).isEmpty
}.mkString("_").toLowerCase()



分类:

技术点:

相关文章:

  • 2021-06-04
  • 2021-11-22
  • 2018-06-23
  • 2022-12-23
  • 2021-11-24
  • 2022-01-10
  • 2021-11-24
  • 2021-12-14
猜你喜欢
  • 2021-10-28
  • 2021-11-22
  • 2021-11-22
  • 2021-11-22
  • 2021-11-22
  • 2021-05-19
相关资源
相似解决方案