zoukankan      html  css  js  c++  java
  • Long.parseLong(String s) 其中s必须是数字形式的字符串,才能运用该函数转化为长整型。

     1 public class ConverTo 
     2     
     3     { public static void main(String [] args)
     4        { String numberIn =args[0];
     5          convertNum(numberIn);
     6         }
     7         static void convertNum(String num)
     8            {
     9               long showNumber;
    10               String temp;
    11                 switch(num)
    12                { case "one":
    13                   temp = "1";
    14                   showNumber = Long.parseLong(temp);
    15                   System.out.println(num+"convert to"+showNumber);
    16                   break;
    17                  case "two":
    18                   temp = "2";
    19                   showNumber = Long.parseLong(temp);
    20                   System.out.println(num+"convert to"+showNumber);
    21                   break;
    22                  case "three":
    23                   temp ="3";
    24                   showNumber = Long.parseLong(temp);
    25                   System.out.println(num+"convert to"+showNumber);
    26                   break;
    27                  case "four":
    28                   temp = "4";
    29                   showNumber = Long.parseLong(temp);
    30                   System.out.println(num+"convert to"+showNumber);
    31                   break;
    32                  case "five":
    33                   temp = "5";
    34                   showNumber = Long.parseLong(temp);
    35                   System.out.println(num+"convert to"+showNumber);
    36                   break;
    37                  case "six":
    38                   temp = "6";
    39                   showNumber = Long.parseLong(temp);
    40                   System.out.println(num+"convert to"+showNumber);
    41                   break;
    42                  case "seven":
    43                    temp = "7";
    44                   showNumber = Long.parseLong(temp);
    45                   System.out.println(num+"convert to"+showNumber);
    46                   break;
    47                  case "eight":
    48                    temp = "8";
    49                   showNumber = Long.parseLong(temp);
    50                   System.out.println(num+"convert to"+showNumber);
    51                   break;
    52                  case "nine":
    53                    temp = "9";
    54                   showNumber = Long.parseLong(temp);
    55                   System.out.println(num+"convert to"+showNumber);
    56                   break;
    57                  case "ten":
    58                    temp = "10";
    59                   showNumber = Long.parseLong(temp);
    60                   System.out.println(num+"convert to"+showNumber);
    61                   break;
    62 
    63                  }
    64 
    65             }
    66 
    67      }

    Long.parseLong(String s) 其中s必须是数字形式的字符串,才能运用该函数转化为长整型。

  • 相关阅读:
    [转]SVN服务器搭建和使用(二)
    [转]SVN服务器搭建和使用(一)
    BZOJ 2049 Sdoi2008 Cave 洞穴勘测
    BZOJ 1589 Usaco2008 Dec Trick or Treat on the Farm 采集糖果
    BZOJ 2796 POI2012 Fibonacci Representation
    BZOJ 2115 Wc2011 Xor
    BZOJ 3105 CQOI2013 新Nim游戏
    BZOJ 2460 Beijing2011 元素
    BZOJ 3687 简单题
    BZOJ 1068 SCOI2008 压缩
  • 原文地址:https://www.cnblogs.com/lubocsu/p/4904692.html
Copyright © 2011-2022 走看看