Skip to content

JuliaStrings/StripRTF.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StripRTF

CI

The StripRTF module exports a single function, striprtf(text), that strips all formatting from a string in Rich Text Format (RTF) to yield "plain text".

This code is a Julia port of the Python striprtf package by Joshy Cyriac, which in turn is based on code posted to StackOverflow by Markus Jarderot and Gilson Filho.

API

striprtf([out::IO,] text::AbstractString)

Given a string text in Rich Text Format (RTF), returns a string of "plain text" with all of the RTF formatting removed.

If the optional out argument is supplied, the output is instead written to this output IO stream, returning out.

Example

julia> using StripRTF

julia> striprtf(raw"""
               {\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
               This is some {\b bold} text.\par
               }""")
"This is some bold text.\n"