0

Currently, I have a string with special characters and white spaces. So I want to make a string's first character uppercase only after each dash.

$theString = """
  \r\n
  \r\n
                fraud - conspiracy to defraud - breach of trust - whether claims proven - locus standi - breach of\r\n
                fiduciary duty and equitable fraud - prima facie case - limitation and laches - quantum and costs -\r\n
                whether appellate intervention warranted\r\n
            </i>\r\n
        </p>\r\n
    </CATCHWORDS>
  """

I tried

$result = ucfirst($theString);
echo $result;
//result:

        """
     \r\n
     \r\n
              fraud - conspiracy to defraud - breach of trust - whether claims proven - locus standi - breach of\r\n
            fiduciary duty and equitable fraud - prima facie case - limitation and laches - quantum and costs -\r\n
            whether appellate intervention warranted\r\n
        </i>\r\n
    </p>\r\n
</CATCHWORDS> """


?>

Expected:

   """
 \r\n
 \r\n
          Fraud - Conspiracy to defraud - Breach of trust - Whether claims proven - Locus standi - Breach of\r\n
        fiduciary duty and equitable fraud - Prima facie case - Limitation and laches - Quantum and costs -\r\n
        Whether appellate intervention warranted\r\n
    </i>\r\n
</p>\r\n
</CATCHWORDS>  
"""
Hashmat Waziri
  • 476
  • 9
  • 9

0 Answers0