Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
Line-breaks with whitespace only - rather than with special characters

In relation to this question asked eight years ago; Break Lines by Whitespace Only

Is there a way to ensure lines of text are only broken onto a new line by whitespace — and not special characters such as ',' '?' '!' (as is seemingly the unicode standard)?

For example if I have a string;

jsyY!m,?s juqu8Tz~n j29@jak?ks9 2cz33#gg8*

Whilst there are four different 'word' strings in the above (separated by white-space), the browser breaks the line after '!' ',' or '?' in some circumstances — whereas I want the browser to treat that string of glyphs as a word in itself.

I have found the above thread asking a very similar question — in which it was agreed there is no way to achieve what I want without wrapping parts of the text in elements like — which wouldn't be ideal for me as i'm generating these strings on the fly with javascript.

The question is 8 years old so I wondered if anyone knew if anything had changed in this regard? Thanks for any advice or pointers.

EDIT

This issue has been solved by iterating through the body of text in javascript, adding '' at the beginning of the string, ' ' in the place of every 'space', and at the very end of the string. This seems to stop any part of any individual word breaking and being forced onto a new line (when having its individual glyphs replaced by special characters).

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!