[ create a new paste ] login | about

Link: http://codepad.org/cIZSwwhV    [ raw code | output | fork ]

PHP, pasted on May 23:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

function remove_acronyms($str)
{
	$str_arr = explode(' ', $str);
	if (empty($str_arr)) return false;

	foreach ($str_arr as $index => $val)
	{
		if ($val==strtoupper($val)) unset($str_arr[$index]);
	}
	return implode(' ', $str_arr);
}

$draft = "The war between the CIA and NSA started in K2 when the FBI hired M";

print remove_acronyms($draft);


Output:
1
The war between the and started in when the hired


Create a new paste based on this one


Comments: