久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <small id='MiUwS'></small><noframes id='MiUwS'>

    1. <i id='MiUwS'><tr id='MiUwS'><dt id='MiUwS'><q id='MiUwS'><span id='MiUwS'><b id='MiUwS'><form id='MiUwS'><ins id='MiUwS'></ins><ul id='MiUwS'></ul><sub id='MiUwS'></sub></form><legend id='MiUwS'></legend><bdo id='MiUwS'><pre id='MiUwS'><center id='MiUwS'></center></pre></bdo></b><th id='MiUwS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='MiUwS'><tfoot id='MiUwS'></tfoot><dl id='MiUwS'><fieldset id='MiUwS'></fieldset></dl></div>

        <bdo id='MiUwS'></bdo><ul id='MiUwS'></ul>
      <tfoot id='MiUwS'></tfoot>
    2. <legend id='MiUwS'><style id='MiUwS'><dir id='MiUwS'><q id='MiUwS'></q></dir></style></legend>

        在Java中將字符轉(zhuǎn)換為整數(shù)

        Converting characters to integers in Java(在Java中將字符轉(zhuǎn)換為整數(shù))
            <bdo id='VZyJM'></bdo><ul id='VZyJM'></ul>

          • <legend id='VZyJM'><style id='VZyJM'><dir id='VZyJM'><q id='VZyJM'></q></dir></style></legend>
              <tbody id='VZyJM'></tbody>

                <tfoot id='VZyJM'></tfoot>
                • <i id='VZyJM'><tr id='VZyJM'><dt id='VZyJM'><q id='VZyJM'><span id='VZyJM'><b id='VZyJM'><form id='VZyJM'><ins id='VZyJM'></ins><ul id='VZyJM'></ul><sub id='VZyJM'></sub></form><legend id='VZyJM'></legend><bdo id='VZyJM'><pre id='VZyJM'><center id='VZyJM'></center></pre></bdo></b><th id='VZyJM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VZyJM'><tfoot id='VZyJM'></tfoot><dl id='VZyJM'><fieldset id='VZyJM'></fieldset></dl></div>

                  <small id='VZyJM'></small><noframes id='VZyJM'>

                  本文介紹了在Java中將字符轉(zhuǎn)換為整數(shù)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  誰(shuí)能給我解釋一下這里發(fā)生了什么:

                  Can someone please explain to me what is going on here:

                  char c = '+';
                  int i = (int)c;
                  System.out.println("i: " + i + " ch: " + Character.getNumericValue(c));
                  

                  這將打印 i: 43 ch:-1.這是否意味著我必須依靠原始轉(zhuǎn)換將 char 轉(zhuǎn)換為 int?那么如何將 Character 轉(zhuǎn)換為 Integer?

                  This prints i: 43 ch:-1. Does that mean I have to rely on primitive conversions to convert char to int? So how can I convert a Character to Integer?

                  是的,我知道如果 Character.getNumericValue 不是數(shù)值,那么它會(huì)返回 -1,這對(duì)我來(lái)說(shuō)很有意義.問(wèn)題是:為什么進(jìn)行原始轉(zhuǎn)換會(huì)返回 43?

                  Yes I know Character.getNumericValue returns -1 if it is not a numeric value and that makes sense to me. The question is: why does doing primitive conversions return 43?

                  Edit2: 43+ 的 ASCII,但我希望轉(zhuǎn)換不會(huì)像 getNumericValue 沒(méi)有成功.否則這意味著有兩種語(yǔ)義等效的方式來(lái)執(zhí)行相同的操作但結(jié)果不同?

                  43 is the ASCII for +, but I would expect the cast to not succeed just like getNumericValue did not succeed. Otherwise that means there are two semantic equivalent ways to perform the same operation but with different results?

                  推薦答案

                  Character.getNumericValue(c)
                  

                  java.lang.Character.getNumericValue(char ch) 返回指定 Unicode 字符所代表的 int 值.例如,字符 'u216C'(羅馬數(shù)字 50)將返回一個(gè)值為 50 的 int.

                  The java.lang.Character.getNumericValue(char ch) returns the int value that the specified Unicode character represents. For example, the character 'u216C' (the roman numeral fifty) will return an int with a value of 50.

                  字母 AZ 大寫(xiě) ('u0041' 到 'u005A')、小寫(xiě) ('u0061' 到 'u007A') 和完整寬度變體 ('uFF21' 到 'uFF3A' 和 'uFF41' 到 'uFF5A') 形式的數(shù)值從 10 到 35.這與 Unicode 規(guī)范無(wú)關(guān),它不為這些 char 值分配數(shù)值.

                  The letters A-Z in their uppercase ('u0041' through 'u005A'), lowercase ('u0061' through 'u007A'), and full width variant ('uFF21' through 'uFF3A' and 'uFF41' through 'uFF5A') forms have numeric values from 10 through 35. This is independent of the Unicode specification, which does not assign numeric values to these char values.

                  此方法返回字符的數(shù)值,作為非負(fù)整數(shù)值;

                  This method returns the numeric value of the character, as a nonnegative int value;

                  -2 如果字符的數(shù)值不是非負(fù)整數(shù);

                  -2 if the character has a numeric value that is not a nonnegative integer;

                  -1 如果字符沒(méi)有數(shù)值.

                  -1 if the character has no numeric value.

                  這里是鏈接.

                  這篇關(guān)于在Java中將字符轉(zhuǎn)換為整數(shù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯(cuò)誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語(yǔ)句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數(shù)的三元表達(dá)式的類(lèi)型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲(chǔ)出現(xiàn)的每個(gè)字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語(yǔ)?)
                • <tfoot id='1Av3Q'></tfoot>

                      <tbody id='1Av3Q'></tbody>

                    <small id='1Av3Q'></small><noframes id='1Av3Q'>

                        • <legend id='1Av3Q'><style id='1Av3Q'><dir id='1Av3Q'><q id='1Av3Q'></q></dir></style></legend>

                          <i id='1Av3Q'><tr id='1Av3Q'><dt id='1Av3Q'><q id='1Av3Q'><span id='1Av3Q'><b id='1Av3Q'><form id='1Av3Q'><ins id='1Av3Q'></ins><ul id='1Av3Q'></ul><sub id='1Av3Q'></sub></form><legend id='1Av3Q'></legend><bdo id='1Av3Q'><pre id='1Av3Q'><center id='1Av3Q'></center></pre></bdo></b><th id='1Av3Q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1Av3Q'><tfoot id='1Av3Q'></tfoot><dl id='1Av3Q'><fieldset id='1Av3Q'></fieldset></dl></div>
                          • <bdo id='1Av3Q'></bdo><ul id='1Av3Q'></ul>

                            主站蜘蛛池模板: 久草在线在线精品观看 | 久久精品欧美一区二区三区不卡 | 天天操天天拍 | 日韩高清一区二区 | 亚洲精品v | 国产 日韩 欧美 在线 | 日韩电影一区二区三区 | 中文字幕免费在线 | 国产成人精品一区二区三 | 黄色毛片在线观看 | 亚洲精品在线91 | 亚洲国产精品久久久久秋霞不卡 | 国产精品自产拍在线观看蜜 | 久久精品亚洲精品国产欧美 | 在线激情视频 | 亚洲精品久久久一区二区三区 | 亚洲一区二区三区视频 | 国产精品欧美一区二区 | 日韩第一页 | www.黄网 | 激情综合五月 | 国产资源在线播放 | 99热最新| 特级毛片爽www免费版 | 草久在线视频 | 日韩在线播放视频 | 日本三级网址 | 国产视频精品在线 | 色男人的天堂 | 天天夜夜操 | 日本福利在线 | 伊人国产精品 | 九九热精品视频在线观看 | 男女深夜网站 | 精品国产1区2区3区 在线国产视频 | 欧美成人精品一区二区男人看 | 午夜精品影院 | 开操网| 亚洲欧美视频一区 | 国产精品一区在线 | 亚洲在线免费观看 |