How do I easily remove line breaks?

I scan documents using the OCR feature in iOS 15 and use a simple mail action afterwards. How do I remove all line breaks before sending the text?

Thanks!

There are a number of example actions for removing line breaks in the Directory. The Strip Line Feeds one works on the text selection, if you search there are a few others as well.

1 Like

Is there anything that will remove line breaks but preserve paragraph breaks?

A line break is indicated by a new line character. How would you define a “paragraph break”? Two successive new lines, two or more successive new lines, or something else?

I’ve bumped Strip Line Feeds to the top of my first action group. It’s very useful. Using copy-paste the IOS OCR feature interprets both the visual end of a text line and a paragraph as a line break (single new line character).

The last line of text in a paragraph that breaks /n
on the page./n
And a new paragraph starts but again only with a single line break. /n

So it doesn’t seem possible to parse say two new line characters as a paragraph?

Do you mean the action you are using doesn’t do this rather than it not being possible? I don’t see why an action couldn’t search for a new line not immediately followed or preceded by a second one and replace it with a ‘null’ string to remove single newline characters.

I think the problem is that the OCR’d text (using the iOS OCR method in iOS 15) places a single newline character both within a paragraph and at the end of a paragraph. There are no double newline characters.

2 Likes

Ah, thanks. So the point is that it’s the Apple OCR that’s not distinguishing line spacing correctly and making what would be a paragraph spacing I distinguishable from a soft wrap - which the OCR would rightly read as a new line as it is not analysing the text for context.

Yes, I think that is correct. I went to the Apple Feedback site and submitted a bug report for the Camera app.

When I use the step Include Action and set it to Strip Line Feed, nothing happens when using this action this way (no line breaks removed). How do I integrate it properly in my workflow?

Thanks!

That depends on what your starting with, and your action you are including in. The include step would often be sufficient to incorporate into another action, but really you need to share that and some sample text to provide a clear idea of what you have.