Extract key, value params from the resources of a url

后端 未结 2 763
梦谈多话
梦谈多话 2021-01-26 01:50

Hi Everyone I\'m working with the next url and I have to get the key-values params from this url the url could be in the next formats:

http://www.espn.com/watch/?gameId=

2条回答
  •  再見小時候
    2021-01-26 02:56

    import java.nio.file.Paths
    
    def u=new URL("http://www.espn.com/fantasy/story/id/24664478/fantasy-soccer-la-liga-fantasy-transfer-market-matchweek-4")
    def p = Paths.get(u.getPath())
    
    println p[2]
    println p[3]
    

    prints

    id
    24664478
    

提交回复
热议问题