zoukankan      html  css  js  c++  java
  • 自动生成用户名,密码的方法

    1.随机取6位数的数字,做为密码

          public String getpassword(){
      
                  Random r = new Random();
                  int x = r.nextInt(999999);
                  String a = String.valueOf(x);
                  return a;
          }

    2.取8位数做为用户名,前两位为AD,后几位为从数据库中取出的ID,不足8位时中间补0

          public String getLoginName(String seqcode){
                   //seqcode是传过来的流水号
                   int id = Integer.parseInt(seqcode);
                   String LoginName="AD"+(""+(id+1000000)).substring(1);
                   return LoginName;
          }

    3.从数据库中取出密码,用*把密码替换掉

          //oldPassword是从库中取出的密码,"."表示任意字符

             String newPassword = oldPassword.replaceAll(".","*");

  • 相关阅读:
    Dictionaries and lists
    Looping and dictionaries
    Dictionary as a set of counters
    Dictionaries
    List exercise
    Lists and strings
    Copying lists
    Objects and values
    [luoguP1944] 最长括号匹配_NOI导刊2009提高(1)
    [luoguP1868] 饥饿的奶牛(DP)
  • 原文地址:https://www.cnblogs.com/wifi/p/2192800.html
Copyright © 2011-2022 走看看