Make the plus sign a string in java
Solution 1
It looks to me like the most likely culprit is the font you are using. I would double check that the plus symbol doesn't have a circle in that font. There is another symbol, the "xor" symbol ("\u2295"
) that is a plus with a circle around it. I can't think of a reason why the plus symbol would be replaced with this symbol, but you might try displaying this character specifically to see if it looks like what you are seeing in the font you are using.
Solution 2
String plusSign = URLEncoder.encode("+", "UTF-8");
Solution 3
String plusSign = "\u002B"; // unicode
eBehbahani
Updated on June 14, 2022Comments
-
eBehbahani over 1 year
So I want the plus sign to be stored as a string and displayed to the screen later; so in this case I have
String plusSign = "+";
but when I display the above on screen, I get a weird plus sign that has a circle around it. I am using the variable in an app that I'm making so using android may have something to do with the strange format. Is this how the plus sign is supposed to look or is there a way to make it look like a normal plus(a cross with no circle)?
Let me add some alternatives I've tried. The first thing I did was see if the unicode version of the plus sign would look any different but nothing appeared when I displayed it(the code was \u002B). I, also, looked at the ascii version but I wasn't sure how to convert it to a string.
Here is the code I use to display the string onScreen
Addition = new Text(PositionX, PositionY, standardFont, "Intergers" + plusSign + "Integers"); mScene.attachChild(Addition);
I use andEngine, so here is the Text class http://code.google.com/p/andengine/source/browse/src/org/anddev/andengine/entity/text/Text.java
It looks like it is related to android: http://www.droidforums.net/forum/droid-x-faq/65474-what-those-icons.html
So it seems like if you use a font that does not support a certain character, it defaults to what ever android uses.
-
eBehbahani almost 12 yearsI didn't use the quotes when applying the unicode, which would explain why it didn't work. However the same problem occurs. I get a plus with a circle around it. I feel like this may just be an android thing.
-
eBehbahani almost 12 yearsNope, here is the font I use dafont.com/zrnic.font. The plus sign looks normal. The symbol I see look like the xor symbol but the color is inverted and it is much smaller than the xor symbol