3

I was wondering what the character code of the square root symbol is in java? That is, I want to be able to print a square root sign on screen inside a string of other characters, or as the label on a button.

scaevity
  • 3,991
  • 13
  • 39
  • 54
  • 1
    I don't know why everyone is so enraged about this perfectly legitimate question. It doesn't appear that anyone here actually knows the answer. – DOK Jul 17 '11 at 21:26
  • @DOK I think that's because it's not so java related question - but concerning unicode. – om-nom-nom Jul 17 '11 at 21:32
  • Also, don't forget about using Charmap (at least in a Windows environment). If you show Unicode characters, you can easily search for the character you want, select it, and get the unicode value. – D.N. Jul 17 '11 at 21:38
  • Note that the font you use must have the character for it to be visible. Also Console windows often use a different codepage giving strange results. – Thorbjørn Ravn Andersen Jul 17 '11 at 22:08
  • 1
    @DOK - I can think of 3 reasons reasons to down-vote. 1) Googling it is a better approach, 2) question of no interest to anyone but the OP, and 3) wanting to discourage +100,000 almost identical questions. But the idea that nobody actually knows the answer is ridiculous. (BTW: I didn't down-vote myself.) – Stephen C Jul 17 '11 at 22:47
  • 2
    Well, guys, you could pretty much Google most of the questions asked here. And clearly, the person asking the question got the insight that what they were looking for was Unicode. If you don't know it's "Unicode" you're looking for, how can you Google it? You have to wade through all those other approaches. I think this is a perfectly reasonable question, and we have a satisfied user. – DOK Jul 17 '11 at 22:56
  • @DOK - the OP included the 'unicode' tag himself. I think we can conclude that he / she recognized its relevance. Anyway, the way I see Q/A downvotes is *primarily* as a hint to the SO search engine to keep the corresponding page out of search results. Rage has nothing to do with it. – Stephen C Jul 17 '11 at 23:26
  • 3
    +1 to help this legitimate question – Rudy Jul 18 '11 at 02:27
  • @Stephen I added the unicode tag afterwards, once I realized that it was relevant – scaevity Jul 18 '11 at 07:31
  • 1
    @Stephen C Just for the record a google search brought me here. I'm glad it was asked. – Kevin Bigler Mar 14 '13 at 21:05

3 Answers3

4

Take a look at the Unicode character charts at http://www.unicode.org/charts/

See also http://www.google.com/search?q=square+root+character - you might find what you're looking for as the very first hit...

Alnitak
  • 334,560
  • 70
  • 407
  • 495
  • Since the OP doesn't know about Unicode, the search query should be this: http://www.google.com/search?q=square+root+character. It's even more obvious. :) – Roland Illig Jul 17 '11 at 21:20
  • thanks for the link to the unicode character charts,that's really helpful! – scaevity Jul 17 '11 at 21:33
  • The hard part is not about finding the code point needed. It's about getting the output encoding correct. – tchrist Jul 19 '11 at 04:14
3

I am sure it's \u221A. Try it out or try googling it, and you might end up with something else (I mean a list of others).

EDIT: This would be helpful --> https://www.fileformat.info/info/unicode/char/search.htm

Marvin
  • 853
  • 2
  • 14
  • 38
DaMainBoss
  • 2,035
  • 1
  • 19
  • 26
1

I found it. click here, this site has more unicode mathematical symbols than I was previously aware of. On the right of the page is what you want, its a hexidecimal number, here's how you would get the unicode character from the hexidecimal number in java.

char[] LESS_THAN = Character.toChars(0x3c);

Basically you're replacing the two symbols at the beginning (I forgot what they were already) with a 0 and passing it into that method. I believe 0x003c is the same value, 60 I think but I'm probably wrong about that, and I don't think its case sensitive so a capital 'c' should work as well. Hope that helped, good luck.

Kevin Bigler
  • 256
  • 1
  • 2
  • 9