title: How to insert a string after a certain number of string characters in XQuery?
body: <p>I want to insert a string (in this case, a linebreak, <code>\L</code>) after 25 characters into a string, but <strong>only</strong> at the next available whitespace, in order to avoid splitting words like below:</p>
  
  <pre><code>This is the example sente\L nce for you.
  </code></pre>
  
  <p>The correct output would be like this:</p>
  
  <pre><code>This is the example sentence\L for you.
  </code></pre>
  
  <p>The line break should occur approximately after 25 characters on each row, so a longer example would look like:</p>
  
  <pre><code>This is a longer example\L
  for you; it actually contains\L
  more than 50 characters.
  </code></pre>
  
  <p>What would be the simplest way to implement this in XQuery?</p>