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