StripRTF.jl

Strip RTF to plain text
Author JuliaStrings
Popularity
5 Stars
Updated Last
4 Months Ago
Started In
May 2023

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"

Required Packages

Used By Packages

No packages found.