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.
You can join strings using either the addition (+) operator or the String's concat() method.
In Java, the plus sign can be used to perform arithmetic addition. It can also be used to concatenate strings. When the plus sign is used in this manner, the operand on the right is automatically converted to a character string before being concatenated with the operand on the left.
One can use the StringBuffer class method namely the insert() method to add character to String at the given position. This method inserts the string representation of given data type at given position in StringBuffer.
+ : Unary plus indicates the positive value (numbers are positive without this, however). It performs an automatic conversion to int when the type of its operand is the byte, char, or short. This is called unary numeric promotion. ++ : Increment operator, used for incrementing the value by 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.
String plusSign = URLEncoder.encode("+", "UTF-8");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With