Jump to content

[SOLVED] splitting strings


gazever

Recommended Posts

Ok,

 

so after spending nearly all day on this problem, could someone please point me in the right direction.

 

I am working on some scripts to format crossword clues etc.

 

If I have a clue like the one below

 

In which ocean was the Mary Celeste found abandoned and adrift? <8>

 

I need to format this so there are a maximum of 18 characters per line, but not splitting any of the words, so I need to get it formatted like below

 

In which ocean was

the Mary Celeste

found abandoned

and adrift? <8>

 

So only break it apart where there are spaces at the previous space before the 18th character, I need to put in a marker character where the line returns are put for part of my script further into it, so the completely formatted text will look like below,

 

In which ocean was

§the Mary Celeste

§found abandoned

§and adrift? <8>

 

I need this script to work for all length clues which is why I'm getting in such a mess with it and going round in circles,

 

Please help.

 

Gaz

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.