This is more of a PHP question then a WordPress question.
If you want to remove punctuation marks like (.,-;:) you can try this recursive version:
$s = get_post_meta( $post->ID, 'one_line_summary', TRUE );
if( function_exists( 'remove_punctuation_marks' ) )
$s = remove_punctuation_marks( $s );
with
/**
* Remove punctuation marks (.,-;:) if they're the last characters in the string
* WPSE: 119519
*
* @param string $s
* @return string $s
*/
function remove_punctuation_marks( $s )
{
$remove = array( '.', ',', '-', ';', ':' ); // Edit this to your needs
if( in_array( mb_substr( $s, -1 ), $remove, TRUE ) )
$s = remove_punctuation_marks( mb_substr( $s, 0, -1 ) );
return $s;
}
where you can define $remove to your needs and mb_substr() is a multi-byte version of substr().
Example:
The following test:
echo remove_punctuation_marks( '...Hello world...:,;' );
gives the output:
...Hello world
Update:
It’s better to use rtrim() as @toscho pointed out 😉
Then in your case:
$s = get_post_meta( $post->ID, 'one_line_summary', TRUE );
$s = rtrim( $s, '.,;:' );
where you can add to the list (.,;:) of punctuation marks to remove.