Jump to content

Checking a few strings.


takn25

Recommended Posts

Hi, I want to check two things if some one could help thanks. I am not an expert at REGEX just learning.

 

Firstly I want to check if a string has a - at the end for example.

 

$string= "Lion"; There is no - at the end  I would like to add a  ( - )  . So $string becomes LION-

 

Second thing I want to check for example if the user has inputted some excessive use of BLANK SPACE and turn it  in to just single space for example.

 

I                      ROCK                  THIS          becomes  I ROCK THIS.  Thanks help is much appreciated.     

 

       

Link to comment
https://forums.phpfreaks.com/topic/230404-checking-a-few-strings/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.