On Thu, 2024-08-15 at 06:06 +0000, Juergen Spitzmueller wrote:
> -    return val.strip('"')
> +    # remove only outer pair of quotes,
> +    # hence do not use strip('"')
> +    if val[:1] == '"':
> +        val = val[1:]
> +    if val[-1:] == '"':
> +        val = val[:-1]
> +    
> +    return val

This will only fail for cases where there are multiple opening and
closing quotes.
Is that our case?


BTW I usually prefer code that is more expressive:

if val.startswith('"'):
    val =  val[1:]
if val.endswith('"'):
    val =  val[:-1]


On a tangent note, since the C++20 standard strings have the
starts_with and ends_with methods. :-)

-- 
José Abílio
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to