Give me clue to do this task..how to make function of substr..?
write an application that prompt the user to enter a stringed.the course then utilize function substr to reove every one of the vowels with the string.electronic.g when str=”there” and then after eliminating str=”thr”.
Here’s the PHP functionality:
function remove_vowels($string)
$length = strlen($string);
if ($length)
$vowels_array(“a”, “e”, “i”, “o”, “u”, “y”);
$new_string = “”;
intended for ($i=0; $i<$length; $i++)
if (! in_array($string$i, $vowels_array)) $new_string.= $string$i;
go back $new_string;
else
go back “”;
P.S.It can be done even better with PHP nonetheless this example need to be clear enough so you might adapt it towards programming language of your choice.Should you be using PHP, here is a less complicated variant:
function remove_vowels($string)
$length = strlen($string);
if ($length)
$vowels_array(“a”, “e”, “i”, “o”, “u”, “y”);
go back str_replace($vowels_array, “”, $string);
else
go back “”;
Leave a Reply
You must be logged in to post a comment.