Function Repository Resource:

UpsideDownTextConvert

Source Notebook

Convert text to upside-down form

Contributed by: Anton Antonov

ResourceFunction["UpsideDownTextConvert"][txt]

writes the given text txt upside-down.

Details

ResourceFunction["UpsideDownTextConvert"] works on strings and lists of strings.
ResourceFunction["UpsideDownTextConvert"] reverses the string and replaces characters with upside down forms whereever possible.
Characters without an available upside down form are preserved.

Examples

Basic Examples (2) 

Write text upside-down:

In[1]:=
ResourceFunction["UpsideDownTextConvert"]["Mathematica in the cloud"]
Out[1]=

Write that result upside-down too:

In[2]:=
ResourceFunction["UpsideDownTextConvert"][%]
Out[2]=

Scope (2) 

UpsideDownTextConvert works on sequences of lines. Consider the random haiku (obtained with the resource function RandomEnglishHaiku):

In[3]:=
SeedRandom[9883];
text = ResourceFunction["RandomEnglishHaiku"][]
Out[2]=

Here is the corresponding upside down version:

In[4]:=
ResourceFunction["UpsideDownTextConvert"][text]
Out[4]=

Here we split into verses and make the upside down versions (by invoking UpsideDownTextConvert only once):

In[5]:=
textLines = StringSplit[text, "\n"];
ResourceFunction["UpsideDownTextConvert"][textLines]
Out[6]=

Certain special characters are also inverted:

In[7]:=
ResourceFunction[
 "UpsideDownTextConvert"]["the wolf, the ram, and the raccoon went into a bar ⤵ 🙂"]
Out[7]=

Properties and Relations (2) 

It is natural to use UpsideDownTextConvert with FlipView (clicking on the output flips it):

In[8]:=
FlipView[{"Mathematica", ResourceFunction["UpsideDownTextConvert"]["Mathematica"]}]
Out[8]=

ImageReflect can be used to produce images that resemble the output of UpsideDownTextConvert. Here is a text:

In[9]:=
SeedRandom[9883];
text = ResourceFunction["RandomEnglishHaiku"][]
Out[2]=

Here is a transformation of the text above with ImageReflect:

In[10]:=
ImageReflect[ImageReflect[Rasterize[text]], Left -> Right]
Out[10]=

Compare with the output of UpsideDownTextConvert:

In[11]:=
ResourceFunction["UpsideDownTextConvert"][text]
Out[11]=

Possible Issues (1) 

Some special symbols do not have upside-down equivalents. In some cases the results might be confusing:

In[12]:=
ResourceFunction["UpsideDownTextConvert"]["ʕ\[Bullet]ᴥ\[Bullet]ʔ"]
Out[12]=

Neat Examples (1) 

Show a haiku along with its upside down form:

In[13]:=
SeedRandom[332];
text = ResourceFunction["RandomEnglishHaiku"][];
ColumnForm[{text, Spacer[3], ResourceFunction["UpsideDownTextConvert"][text]}]
Out[15]=

Publisher

Anton Antonov

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.1 – 19 August 2024
  • 1.0.0 – 16 August 2024

Related Resources

License Information