Forum Discussion

indraniria's avatar
indraniria
Contributor
2 years ago
Solved

If a network path contains $ sign, how to access that path using groovy?

As of now , I am mapping that network drive to a local drive in my system, list below: File f = new File("A:\\Private\\Test\\")   But in actual network drive path I have a $ sign like, \\opscif\\$...
  • KarelHusa's avatar
    2 years ago

    The dollar is a special sign in Groovy and has its function in double-quoted "strings".

     

    You have two options:

    • use single quotes, such as 'hello$'
    • use double quotes with a backslash before the dollar sign, i.e., "hello\$"

     

    Best regards,

    Karel