Revision 94042ae4
b/src/Ganeti/Utils.hs | ||
---|---|---|
318 | 318 |
(which is assumed to be a separator) to be absent from the string if the string |
319 | 319 |
terminates there. |
320 | 320 |
|
321 |
>>> chompPrefix "foo:bar:" "a:b:c"
|
|
321 |
\>>> chompPrefix \"foo:bar:\" \"a:b:c\"
|
|
322 | 322 |
Nothing |
323 | 323 |
|
324 |
>>> chompPrefix "foo:bar:" "foo:bar:baz"
|
|
325 |
Just "baz"
|
|
324 |
\>>> chompPrefix \"foo:bar:\" \"foo:bar:baz\"
|
|
325 |
Just \"baz\"
|
|
326 | 326 |
|
327 |
>>> chompPrefix "foo:bar:" "foo:bar:"
|
|
328 |
Just ""
|
|
327 |
\>>> chompPrefix \"foo:bar:\" \"foo:bar:\"
|
|
328 |
Just \"\"
|
|
329 | 329 |
|
330 |
>>> chompPrefix "foo:bar:" "foo:bar"
|
|
331 |
Just ""
|
|
330 |
\>>> chompPrefix \"foo:bar:\" \"foo:bar\"
|
|
331 |
Just \"\"
|
|
332 | 332 |
|
333 |
>>> chompPrefix "foo:bar:" "foo:barbaz"
|
|
333 |
\>>> chompPrefix \"foo:bar:\" \"foo:barbaz\"
|
|
334 | 334 |
Nothing |
335 | 335 |
-} |
336 | 336 |
chompPrefix :: String -> String -> Maybe String |
Also available in: Unified diff