salman_ahad@yahoo.com Posted October 22, 2009 Share Posted October 22, 2009 I want to be able to check if my string contains ". $sent = split('[.!?]',$para);//split on .!? "Lets say this is my sentence." //ended with " after . Then I am getting next sentence as " This is second sentence. I dont want the sentence to start with " Quote Link to comment https://forums.phpfreaks.com/topic/178554-solved-check-a-string-for-certain-character/ Share on other sites More sharing options...
mikesta707 Posted October 22, 2009 Share Posted October 22, 2009 str_replace('"', "", $string); Quote Link to comment https://forums.phpfreaks.com/topic/178554-solved-check-a-string-for-certain-character/#findComment-941647 Share on other sites More sharing options...
cags Posted October 22, 2009 Share Posted October 22, 2009 Assumably the double quote may be an acceptable character further in the string making a blanket replace not the best solution. You could use one of the trim functions in the limited example given by the OP, but there might be an altogether more elegant solution depending on the overall objective. Quote Link to comment https://forums.phpfreaks.com/topic/178554-solved-check-a-string-for-certain-character/#findComment-941661 Share on other sites More sharing options...
salman_ahad@yahoo.com Posted October 22, 2009 Author Share Posted October 22, 2009 Any help guys?? Quote Link to comment https://forums.phpfreaks.com/topic/178554-solved-check-a-string-for-certain-character/#findComment-942216 Share on other sites More sharing options...
salman_ahad@yahoo.com Posted October 22, 2009 Author Share Posted October 22, 2009 I used ltrim to remove " from left. Thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/178554-solved-check-a-string-for-certain-character/#findComment-942278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.