Fixed Width Parsing Conundrum

瀏覽次數:13 次
跳到第一則未讀訊息

Potts Jeff

未讀,
2023年11月19日 晚上9:28:522023/11/19
收件者: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

未讀,
2023年11月20日 晚上8:08:152023/11/20
收件者: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

未讀,
2023年11月22日 上午8:51:012023/11/22
收件者: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.
回覆所有人
回覆作者
轉寄
0 則新訊息