I need to add a subscript (a little number next to a character, like 2 or 3 - note: not a power of...) to a string [variable]. Is this possible? I don't want the code to be lengthy as I will need to process a lot of formulas, one at a time. Thanks.
Asked
Active
Viewed 3,340 times
2 Answers
0
You will have to use the character set subscript numbers. Strings do not contain formatting.

Brad
- 159,648
- 54
- 349
- 530
-
How do I use these "character set" subscript numbers? Thanks for a quick answer! – Apr 30 '12 at 19:51
0
Is this possible? No - string variables do not contain formatting.
In order to achieve this you will need to add some sort of formatting to your string and display it in something that can show different formats - for example a RichTextBox control
Try adding a RichTextBox control and running the following line:
RichTextBox1.Rtf = "{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Segoe UI;}}\viewkind4\uc1\pard\ltrpar\sa200\sl276\slmult1\f0\fs22 sometext\fs12 subscript\fs22\par\pard\ltrpar\f1\fs17\par}"
I don't claim to know what all the formatting is in here so I will leave you to figure that out yourself - hope that helps...

Matt Wilko
- 26,994
- 10
- 93
- 143
-
The thing is that I'm making a Class Library that will only spit out Strings/Variables. Like for example my other project (very similar to this, but considering elements of the periodic table): https://github.com/RafalChmiel/Elementt - Thanks anyway! – May 01 '12 at 17:19