• 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必须是数字形式的字符串,才能运用该函数转化为长整型。

  • 相关阅读:
    mongodb备份与恢复
    MongoDB-3.4安装文档
    (转)Zabbix 3.2.7编译安装记录
    (转)error while loading shared libraries:libmysqlclient.so.18 错误
    (转)如何使用Journalctl查看并操作Systemd日志
    (转)基于CentOS 7安装Zabbix 3.4和Zabbix4.0
    (转)yum安装MariaDB(使用国内镜像快速安装,三分钟安装完毕)
    (转)nmon和nmon analyser的下载和使用
    (转)Db2 数据库常见堵塞问题分析和处理
    (转)我是一个线程
  • 原文地址:https://www.cnblogs.com/lubocsu/p/4904692.html
Copyright © 2020-2023  润新知