Skip to main content

Make the plus sign a string in java


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.


Source: Tips4all
Source: Tips4allSource: CCNA FINAL EXAM

Comments

  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.

    ReplyDelete
  2. String plusSign = "\u002B"; // unicode

    ReplyDelete
  3. String plusSign = URLEncoder.encode("+", "UTF-8");

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex