I want to use the following string literal inside my groovy program without having to escape the backslashes:
C:\\dev\\username
Here is what I have t
Wow, another gotcha with putting Windows files paths in slashy strings. Nice catch. The gotcha I've encountered before was including a trailing backslash on the path, e.g. /C:\path\/
, which results in an unexpected char: 0xFFFF
error.
Anyways, for the sake of an answer, given that Windows paths are case insensitive, why not exploit it for once?
def s = /C:\DEV\USERNAME/
The \u
unicode character escape sequence is case sensitive.