Fixed Width Parsing Conundrum

12 views
Skip to first unread message

Potts Jeff

unread,
Nov 19, 2023, 9:28:52 PM11/19/23
to TextSoap
I have data that needs to fit into a 40 mono spaced character width. (The width of the original Kindle Fire) Here is the format;

1234567890123456789012345678901234567890

1   lb     Ground beef

1   Jar    Catelli Garden Select Tomato & Basil Pasta Sauce

½   tsp    Seasoning Salt



I am using the following cleaner to turn tabs into fixed width non breaking spaces which works. 
SCR-20231119-ths.png

The problem I am having is that the text in excess of 40 characters breaks in the Kindle Viewer and the results are as follows;

1234567890123456789012345678901234567890

1   lb     Ground beef

1   Jar    Catelli Garden Select Tomato

 & Basil Pasta Sauce

½   tsp    Seasoning Salt


I cannot figure how to fold the text within the cleaner and add 11 fixed width non breaking spaces so that the output looks like the following;

1234567890123456789012345678901234567890

1   lb     Ground beef

1   Jar    Catelli Garden Select Tomato

           & Basil Pasta Sauce

½   tsp    Seasoning Salt


Your help or direction is greatly appreciated


Jeff

Mark Munz

unread,
Nov 20, 2023, 8:08:15 PM11/20/23
to text...@googlegroups.com
image.png

Put this at the end of your cleaner (after col 1 & 2) are converted. 
  • Take column three
  • Wrap it at 28 characters
  • Add "^@@@@@@@@@@" to the beginning of the lines, skipping the first. We do this with the Modify Results option. 
  • Re-wrap the text

at the end of the cleaner: 
  • we take the ^@ and convert it to a return + @
  • finish by converting any @ to \u2007.

Tip: You can simplify your cleaner by having only one conversion action from @ to \u2007 at the end of your cleaner.
This would then convert ALL @ to the non-breaking space.

Hope that helps. 🙂



--
You received this message because you are subscribed to the Google Groups "TextSoap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to textsoap+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/textsoap/e94b041e-4c76-475c-8868-6993b184a503n%40googlegroups.com.


--
Mark Munz
unmarked software
https://textsoap.com/

Potts Jeff

unread,
Nov 22, 2023, 8:51:01 AM11/22/23
to TextSoap
Thanks for that help! I learned a lot from looking at how you accomplished this, and yes I should refactor the  @ to \u2007 portion to make it tighter.
Reply all
Reply to author
Forward
0 new messages