Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda