i want to change 2.5 to 2½. Not sure how to change it.
Let say I have “AMZN 2½ 22” in a long text that I have to highlight in java swing textpane but I have values in three variable as below
A = AMZN
B = 2.5
C = 22
Based on this value I will not be able to match so changing B to Rational number (String) and then matching and it’s working fine but I don’t want to do this… it’s just a temp fix.
Can someone help me ?
B = B.toString().replace(".25", "¼")
.replace(".5", "½")
.replace(".75", "¾")
.replace(".375", "⅜")
.replace(".625", "⅜")
.replace(".125", "⅛")
.replace(".875", "⅞")
.replace(".0", "")
.replace(".000", "")
.replace(".00", "");
Thanks