How programmatically filter text? I need to display a text and apply the chosen filter to it. The text is saved using the text_format field type.

So I know the original text, I know the chosen format type but I don't know how to actually filter the text.

How can I programmatically filter text? Thanks
This post on stackoverflow describes how to do this programmatically. 

Just call check_markup and pass in your text and the filter id.

check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE)



  Run all the enabled filters on a piece of text.