PHP - Capitalize the first letter after a dot or after a dot and a space
up vote
2
down vote
favorite
I would like to capitalize the first letter after a dot or after a dot and a space.
$string="I am a string with several periods.period #1. period #2.";
This should be the final string:
I am a string with several periods.Period #1. Period #2.
I have already searched for a solution on stackoverflow but the solution that i found was only for capitalize the initial letter after just a dot and not for a dot and a space.
php regex string function text
add a comment |
up vote
2
down vote
favorite
I would like to capitalize the first letter after a dot or after a dot and a space.
$string="I am a string with several periods.period #1. period #2.";
This should be the final string:
I am a string with several periods.Period #1. Period #2.
I have already searched for a solution on stackoverflow but the solution that i found was only for capitalize the initial letter after just a dot and not for a dot and a space.
php regex string function text
1
I find the duplicate incorrect. There is nothing in that answer that even mentions the problem OP explains, the optional number of spaces.
– Andreas
Nov 10 at 20:48
@Andreas, you are right! I have also consulted the link of Wiktor before asking my question.
– Daniele
Nov 10 at 20:56
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I would like to capitalize the first letter after a dot or after a dot and a space.
$string="I am a string with several periods.period #1. period #2.";
This should be the final string:
I am a string with several periods.Period #1. Period #2.
I have already searched for a solution on stackoverflow but the solution that i found was only for capitalize the initial letter after just a dot and not for a dot and a space.
php regex string function text
I would like to capitalize the first letter after a dot or after a dot and a space.
$string="I am a string with several periods.period #1. period #2.";
This should be the final string:
I am a string with several periods.Period #1. Period #2.
I have already searched for a solution on stackoverflow but the solution that i found was only for capitalize the initial letter after just a dot and not for a dot and a space.
php regex string function text
php regex string function text
asked Nov 10 at 16:35
Daniele
647
647
1
I find the duplicate incorrect. There is nothing in that answer that even mentions the problem OP explains, the optional number of spaces.
– Andreas
Nov 10 at 20:48
@Andreas, you are right! I have also consulted the link of Wiktor before asking my question.
– Daniele
Nov 10 at 20:56
add a comment |
1
I find the duplicate incorrect. There is nothing in that answer that even mentions the problem OP explains, the optional number of spaces.
– Andreas
Nov 10 at 20:48
@Andreas, you are right! I have also consulted the link of Wiktor before asking my question.
– Daniele
Nov 10 at 20:56
1
1
I find the duplicate incorrect. There is nothing in that answer that even mentions the problem OP explains, the optional number of spaces.
– Andreas
Nov 10 at 20:48
I find the duplicate incorrect. There is nothing in that answer that even mentions the problem OP explains, the optional number of spaces.
– Andreas
Nov 10 at 20:48
@Andreas, you are right! I have also consulted the link of Wiktor before asking my question.
– Daniele
Nov 10 at 20:56
@Andreas, you are right! I have also consulted the link of Wiktor before asking my question.
– Daniele
Nov 10 at 20:56
add a comment |
4 Answers
4
active
oldest
votes
up vote
0
down vote
accepted
Use regex to match the dot .
, optional space s*
and a letter w
.
Then loop the matches array and do a str_replace.
$str="I am a string with several periods.period #1. period #2.";
preg_match_all("/.s*w/", $str, $matches);
foreach($matches[0] as $match)
$str = str_replace($match, strtoupper($match), $str);
echo $str;
//I am a string with several periods.Period #1. Period #2.
https://3v4l.org/LevU5
To make it slightly more optimized you could add an array_unique before looping since str_replace replaces all equal substrings.
$matches[0] = array_unique($matches[0]);
https://3v4l.org/mIiX8
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
add a comment |
up vote
1
down vote
Preg_replace_callback is your friend:
$string="I am a string with several periods.period #1. period #2.";
$string = preg_replace_callback('/.s*Kw/',
function($m)
return strtoupper($m[0]);
,
$string);
echo $string;
Output:
I am a string with several periods.Period #1. Period #2.
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
add a comment |
up vote
0
down vote
If regex is not an option, something like this might work:
$str = "I am a string with several periods.period #1. period #2.";
$strings = explode('.', $str);
$titleCased = ;
foreach($strings as $s)
$titleCased = ucfirst(trim($s));
echo join(".", $titleCased);
Although, this has the added effect of removing whitespace.
https://3v4l.org/fWGUW
the white space should remain
– Daniele
Nov 10 at 16:59
You could just join with". "
and that would make it "correct" as well. Although that may not be what OP wants though.
– Andreas
Nov 10 at 17:02
@Daniele if you removetrim
you get the expected result with this code. Edit, sorry no you don't. My mistake
– Andreas
Nov 10 at 17:05
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
add a comment |
up vote
0
down vote
I created this simple function and it works like a charm
and you can add delimiters as you like.
function capitalize_after_delimiters($string='', $delimiters = array())
foreach ($delimiters as $delimiter)
$temp = explode($delimiter, $string);
array_walk($temp, function (&$value) $value = ucfirst($value); );
$string = implode($temp, $delimiter);
return $string;
$string ="I am a string with several periods.period #1. period #2.";
$result = capitalize_after_delimiters($string, array('.', '. '));
var_dump($result);
result: string(56) "I am a string with several periods.Period #1. Period #2."
result
excellent solution!
– Daniele
Nov 10 at 18:42
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
|
show 1 more comment
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Use regex to match the dot .
, optional space s*
and a letter w
.
Then loop the matches array and do a str_replace.
$str="I am a string with several periods.period #1. period #2.";
preg_match_all("/.s*w/", $str, $matches);
foreach($matches[0] as $match)
$str = str_replace($match, strtoupper($match), $str);
echo $str;
//I am a string with several periods.Period #1. Period #2.
https://3v4l.org/LevU5
To make it slightly more optimized you could add an array_unique before looping since str_replace replaces all equal substrings.
$matches[0] = array_unique($matches[0]);
https://3v4l.org/mIiX8
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
add a comment |
up vote
0
down vote
accepted
Use regex to match the dot .
, optional space s*
and a letter w
.
Then loop the matches array and do a str_replace.
$str="I am a string with several periods.period #1. period #2.";
preg_match_all("/.s*w/", $str, $matches);
foreach($matches[0] as $match)
$str = str_replace($match, strtoupper($match), $str);
echo $str;
//I am a string with several periods.Period #1. Period #2.
https://3v4l.org/LevU5
To make it slightly more optimized you could add an array_unique before looping since str_replace replaces all equal substrings.
$matches[0] = array_unique($matches[0]);
https://3v4l.org/mIiX8
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Use regex to match the dot .
, optional space s*
and a letter w
.
Then loop the matches array and do a str_replace.
$str="I am a string with several periods.period #1. period #2.";
preg_match_all("/.s*w/", $str, $matches);
foreach($matches[0] as $match)
$str = str_replace($match, strtoupper($match), $str);
echo $str;
//I am a string with several periods.Period #1. Period #2.
https://3v4l.org/LevU5
To make it slightly more optimized you could add an array_unique before looping since str_replace replaces all equal substrings.
$matches[0] = array_unique($matches[0]);
https://3v4l.org/mIiX8
Use regex to match the dot .
, optional space s*
and a letter w
.
Then loop the matches array and do a str_replace.
$str="I am a string with several periods.period #1. period #2.";
preg_match_all("/.s*w/", $str, $matches);
foreach($matches[0] as $match)
$str = str_replace($match, strtoupper($match), $str);
echo $str;
//I am a string with several periods.Period #1. Period #2.
https://3v4l.org/LevU5
To make it slightly more optimized you could add an array_unique before looping since str_replace replaces all equal substrings.
$matches[0] = array_unique($matches[0]);
https://3v4l.org/mIiX8
edited Nov 10 at 16:48
answered Nov 10 at 16:43
Andreas
14.6k31441
14.6k31441
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
add a comment |
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
@Toto I can bet my left arm that it's the person who had his duplicate hammer removed from this question.
– Andreas
Nov 12 at 21:13
add a comment |
up vote
1
down vote
Preg_replace_callback is your friend:
$string="I am a string with several periods.period #1. period #2.";
$string = preg_replace_callback('/.s*Kw/',
function($m)
return strtoupper($m[0]);
,
$string);
echo $string;
Output:
I am a string with several periods.Period #1. Period #2.
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
add a comment |
up vote
1
down vote
Preg_replace_callback is your friend:
$string="I am a string with several periods.period #1. period #2.";
$string = preg_replace_callback('/.s*Kw/',
function($m)
return strtoupper($m[0]);
,
$string);
echo $string;
Output:
I am a string with several periods.Period #1. Period #2.
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
add a comment |
up vote
1
down vote
up vote
1
down vote
Preg_replace_callback is your friend:
$string="I am a string with several periods.period #1. period #2.";
$string = preg_replace_callback('/.s*Kw/',
function($m)
return strtoupper($m[0]);
,
$string);
echo $string;
Output:
I am a string with several periods.Period #1. Period #2.
Preg_replace_callback is your friend:
$string="I am a string with several periods.period #1. period #2.";
$string = preg_replace_callback('/.s*Kw/',
function($m)
return strtoupper($m[0]);
,
$string);
echo $string;
Output:
I am a string with several periods.Period #1. Period #2.
answered Nov 10 at 17:07
Toto
64k175697
64k175697
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
add a comment |
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
1
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
What's going on with all the downvotes to all the answers?
– Sherif Salah
Nov 12 at 19:57
add a comment |
up vote
0
down vote
If regex is not an option, something like this might work:
$str = "I am a string with several periods.period #1. period #2.";
$strings = explode('.', $str);
$titleCased = ;
foreach($strings as $s)
$titleCased = ucfirst(trim($s));
echo join(".", $titleCased);
Although, this has the added effect of removing whitespace.
https://3v4l.org/fWGUW
the white space should remain
– Daniele
Nov 10 at 16:59
You could just join with". "
and that would make it "correct" as well. Although that may not be what OP wants though.
– Andreas
Nov 10 at 17:02
@Daniele if you removetrim
you get the expected result with this code. Edit, sorry no you don't. My mistake
– Andreas
Nov 10 at 17:05
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
add a comment |
up vote
0
down vote
If regex is not an option, something like this might work:
$str = "I am a string with several periods.period #1. period #2.";
$strings = explode('.', $str);
$titleCased = ;
foreach($strings as $s)
$titleCased = ucfirst(trim($s));
echo join(".", $titleCased);
Although, this has the added effect of removing whitespace.
https://3v4l.org/fWGUW
the white space should remain
– Daniele
Nov 10 at 16:59
You could just join with". "
and that would make it "correct" as well. Although that may not be what OP wants though.
– Andreas
Nov 10 at 17:02
@Daniele if you removetrim
you get the expected result with this code. Edit, sorry no you don't. My mistake
– Andreas
Nov 10 at 17:05
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
add a comment |
up vote
0
down vote
up vote
0
down vote
If regex is not an option, something like this might work:
$str = "I am a string with several periods.period #1. period #2.";
$strings = explode('.', $str);
$titleCased = ;
foreach($strings as $s)
$titleCased = ucfirst(trim($s));
echo join(".", $titleCased);
Although, this has the added effect of removing whitespace.
https://3v4l.org/fWGUW
If regex is not an option, something like this might work:
$str = "I am a string with several periods.period #1. period #2.";
$strings = explode('.', $str);
$titleCased = ;
foreach($strings as $s)
$titleCased = ucfirst(trim($s));
echo join(".", $titleCased);
Although, this has the added effect of removing whitespace.
https://3v4l.org/fWGUW
edited Nov 10 at 17:17
Martin
12.2k53377
12.2k53377
answered Nov 10 at 16:58
erickb
4,55121919
4,55121919
the white space should remain
– Daniele
Nov 10 at 16:59
You could just join with". "
and that would make it "correct" as well. Although that may not be what OP wants though.
– Andreas
Nov 10 at 17:02
@Daniele if you removetrim
you get the expected result with this code. Edit, sorry no you don't. My mistake
– Andreas
Nov 10 at 17:05
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
add a comment |
the white space should remain
– Daniele
Nov 10 at 16:59
You could just join with". "
and that would make it "correct" as well. Although that may not be what OP wants though.
– Andreas
Nov 10 at 17:02
@Daniele if you removetrim
you get the expected result with this code. Edit, sorry no you don't. My mistake
– Andreas
Nov 10 at 17:05
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
the white space should remain
– Daniele
Nov 10 at 16:59
the white space should remain
– Daniele
Nov 10 at 16:59
You could just join with
". "
and that would make it "correct" as well. Although that may not be what OP wants though.– Andreas
Nov 10 at 17:02
You could just join with
". "
and that would make it "correct" as well. Although that may not be what OP wants though.– Andreas
Nov 10 at 17:02
@Daniele if you remove
trim
you get the expected result with this code. Edit, sorry no you don't. My mistake– Andreas
Nov 10 at 17:05
@Daniele if you remove
trim
you get the expected result with this code. Edit, sorry no you don't. My mistake– Andreas
Nov 10 at 17:05
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
But this will work. 3v4l.org/RWnfv @erickb feel free to add this to your answer if you want
– Andreas
Nov 10 at 17:10
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
add a comment |
up vote
0
down vote
I created this simple function and it works like a charm
and you can add delimiters as you like.
function capitalize_after_delimiters($string='', $delimiters = array())
foreach ($delimiters as $delimiter)
$temp = explode($delimiter, $string);
array_walk($temp, function (&$value) $value = ucfirst($value); );
$string = implode($temp, $delimiter);
return $string;
$string ="I am a string with several periods.period #1. period #2.";
$result = capitalize_after_delimiters($string, array('.', '. '));
var_dump($result);
result: string(56) "I am a string with several periods.Period #1. Period #2."
result
excellent solution!
– Daniele
Nov 10 at 18:42
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
|
show 1 more comment
up vote
0
down vote
I created this simple function and it works like a charm
and you can add delimiters as you like.
function capitalize_after_delimiters($string='', $delimiters = array())
foreach ($delimiters as $delimiter)
$temp = explode($delimiter, $string);
array_walk($temp, function (&$value) $value = ucfirst($value); );
$string = implode($temp, $delimiter);
return $string;
$string ="I am a string with several periods.period #1. period #2.";
$result = capitalize_after_delimiters($string, array('.', '. '));
var_dump($result);
result: string(56) "I am a string with several periods.Period #1. Period #2."
result
excellent solution!
– Daniele
Nov 10 at 18:42
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
|
show 1 more comment
up vote
0
down vote
up vote
0
down vote
I created this simple function and it works like a charm
and you can add delimiters as you like.
function capitalize_after_delimiters($string='', $delimiters = array())
foreach ($delimiters as $delimiter)
$temp = explode($delimiter, $string);
array_walk($temp, function (&$value) $value = ucfirst($value); );
$string = implode($temp, $delimiter);
return $string;
$string ="I am a string with several periods.period #1. period #2.";
$result = capitalize_after_delimiters($string, array('.', '. '));
var_dump($result);
result: string(56) "I am a string with several periods.Period #1. Period #2."
result
I created this simple function and it works like a charm
and you can add delimiters as you like.
function capitalize_after_delimiters($string='', $delimiters = array())
foreach ($delimiters as $delimiter)
$temp = explode($delimiter, $string);
array_walk($temp, function (&$value) $value = ucfirst($value); );
$string = implode($temp, $delimiter);
return $string;
$string ="I am a string with several periods.period #1. period #2.";
$result = capitalize_after_delimiters($string, array('.', '. '));
var_dump($result);
result: string(56) "I am a string with several periods.Period #1. Period #2."
result
edited Nov 10 at 19:37
Andreas
14.6k31441
14.6k31441
answered Nov 10 at 17:43
Sherif Salah
37327
37327
excellent solution!
– Daniele
Nov 10 at 18:42
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
|
show 1 more comment
excellent solution!
– Daniele
Nov 10 at 18:42
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
excellent solution!
– Daniele
Nov 10 at 18:42
excellent solution!
– Daniele
Nov 10 at 18:42
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
This solution is good but can fail in many ways. If the text has three spaces it fails (or you have to manually add it), if there is a new line after the dot it fails. 3v4l.org/lcBZG
– Andreas
Nov 10 at 19:55
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
I solved his problem as he asked and add some extra features too, but if you want to make it absolutely perfect solution in general, then we can work on that.
– Sherif Salah
Nov 10 at 20:07
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
your proposed problem solved 3v4l.org/QepCm
– Sherif Salah
Nov 10 at 20:19
1
1
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
Serial downvoter in action, all answers has been downvoted at 18h05 UTC
– Toto
Nov 12 at 19:28
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241052%2fphp-capitalize-the-first-letter-after-a-dot-or-after-a-dot-and-a-space%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I find the duplicate incorrect. There is nothing in that answer that even mentions the problem OP explains, the optional number of spaces.
– Andreas
Nov 10 at 20:48
@Andreas, you are right! I have also consulted the link of Wiktor before asking my question.
– Daniele
Nov 10 at 20:56