Проверить пробелы в строке ⇐ Php
-
Anonymous
Проверить пробелы в строке
I have an issue with a string:
$string = 'Hellothere, how are you? I amgood'? I would like to automatically detect there is no whitespace between the tag and the character before, and add a whitespace if it is not available and change it to:
$string = 'Hello there, how are you? I am good'? Using PHP, regular expression? or strtr?
Likewise, for the closing, can we check it will add a whitespace if it isn't exist btw another character meanwhile ignore if it is .,?!;:
next -> next (whitespace added) ! -> ! (Unchanged)
Источник: https://stackoverflow.com/questions/246 ... n-a-string
I have an issue with a string:
$string = 'Hellothere, how are you? I amgood'? I would like to automatically detect there is no whitespace between the tag and the character before, and add a whitespace if it is not available and change it to:
$string = 'Hello there, how are you? I am good'? Using PHP, regular expression? or strtr?
Likewise, for the closing, can we check it will add a whitespace if it isn't exist btw another character meanwhile ignore if it is .,?!;:
next -> next (whitespace added) ! -> ! (Unchanged)
Источник: https://stackoverflow.com/questions/246 ... n-a-string