Menu

Do-it-yourself splitting -- what approach?

gwideman
2007-03-06
2013-04-29
  • gwideman

    gwideman - 2007-03-06

    Paul:  I'd like to cook up a split function which supplies its own split algorithm, and need to know the recommended approach.

    FWIW, this is to create a crude word-wrap function, so needs to start at a particular length and search backwards for eg: space. However, needs to have more heuristics, like prefering split on space, but if that's not found near the end then look for hyphen, and so on.

    I see that your split functions have callbacks, but these appear more directed at doing something after your functions have decided where the split should be, rather than allowing caller to determine the split algorithm.

    It looked to me like I need to duplicate bsplit functionality, inserting my own algorithm. Along the way, I'll need the memory allocation functionality from bcsb(). But bcsb() is static.

    So I feel like I'm fighting the library rather than working with it -- am I taking the wrong approach here?

    Graham

     
    • gwideman

      gwideman - 2007-03-06

      (A bit later...) OK, I got around to just cutting and pasting relevant parts of bsplit() and friends, and have a basic word-wrap function returning wrapped text to a bstrList. I think I've concluded that this just wasn't an area of functionality that you expanded into, fair enough. But it has raised separate curiosity about bstrList editability... on that a separate thread.
      Graham

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.