> -----Original Message----- > From: Finn Bock [mailto:[EMAIL PROTECTED] > > > , the text contains: > > 0x0a 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x54 0x68 0x69 0x73 ... > > the spaces surrounding the LF should be ignores: > > 0x0a 0x54 0x68 0x69 0x73 ... > > and the linefeed turned into a space: > > 0x20 0x54 0x68 0x69 0x73 ... > > and last, two or more consecutive spaces removed: > > 0x20 0x54 0x68 0x69 0x73 ... > > which is exactly what HEAD does! > > But surely that can't be right. I must be missing or misreading something. >
Depends on what is being meant by 'removal' in the last step above, and 'ignoring' in the first...? Juggling a bit, I think the only way to achieve the desired result is to 'replace' spaces surrounded by a LF by one space, then perform the steps : - two, or more consecutive spaces 'ignored': 0x0a 0x20 0x54 ... - turn the linefeed into a space 0x20 0x20 0x54 ... - consecutive spaces 'removed' 0x54 ... In this case, there will never remain a single space as the result of the second step. Hope this gets you on track! Cheers, Andreas