久久久久久久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中將字符轉換為整數

        Converting characters to integers in Java(在Java中將字符轉換為整數)
            <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中將字符轉換為整數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  誰能給我解釋一下這里發生了什么:

                  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.這是否意味著我必須依靠原始轉換將 char 轉換為 int?那么如何將 Character 轉換為 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 不是數值,那么它會返回 -1,這對我來說很有意義.問題是:為什么進行原始轉換會返回 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,但我希望轉換不會像 getNumericValue 沒有成功.否則這意味著有兩種語義等效的方式來執行相同的操作但結果不同?

                  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'(羅馬數字 50)將返回一個值為 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 大寫 ('u0041' 到 'u005A')、小寫 ('u0061' 到 'u007A') 和完整寬度變體 ('uFF21' 到 'uFF3A' 和 'uFF41' 到 'uFF5A') 形式的數值從 10 到 35.這與 Unicode 規范無關,它不為這些 char 值分配數值.

                  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.

                  此方法返回字符的數值,作為非負整數值;

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

                  -2 如果字符的數值不是非負整數;

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

                  -1 如果字符沒有數值.

                  -1 if the character has no numeric value.

                  這里是鏈接.

                  這篇關于在Java中將字符轉換為整數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

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

                            主站蜘蛛池模板: 久久91| 久久精品天堂 | 亚洲国产成人av | 你懂的av| 日韩精品久久 | 瑞克和莫蒂第五季在线观看 | 国产成人精品综合 | 91福利电影在线观看 | 亚洲国产日韩欧美 | 免费观看一级特黄欧美大片 | 日本精品一区二区三区在线观看 | 精品欧美一区二区精品久久 | 天天操网 | 欧美成年网站 | 午夜噜噜噜 | 综合久久99 | 狠狠干狠狠操 | 国产成人在线播放 | 日韩在线中文字幕 | 久久国产精品一区二区三区 | 欧美精品一区三区 | 一区二区三区在线看 | 91电影| www.国产日本 | 亚洲综合二区 | 一本久久a久久精品亚洲 | 俺去俺来也www色官网cms | 久久精品国产一区二区三区不卡 | 久久成人免费 | 午夜三级在线观看 | 欧美成人专区 | 国产乱码精品一区二区三区五月婷 | 99精品网 | 伊人91在线 | 毛片在线免费 | 精品九九久久 | 亚洲性视频 | a国产视频| 欧美视频二区 | 日韩在线观看一区 | 日韩毛片网 |