Search code examples
flat-filedelimiterbackspace

Backspace delimited flat files


Has any one ever seen a backspace delimited flat file? My requirement is to parse such a file but I am not able to put a backspace character into a file to check if I am able to detect it.


Solution

  • Splitting shouldn't be any harder than using any other delimiter. It's just another character, after all. In Python, for instance:

    >>> x = "apples\bbanana\bcoconut\bthese are delicious!"
    >>> x.split('\b')
    ['apples', 'banana', 'coconut', 'these are delicious!']
    

    Most languages use \b as the escape character for a backspace. If yours doesn't you can also include the ASCII control code for backspace itself, which is \x08.