当前位置: 首页 > news >正文

沈阳网站建设小工作室商业网站

沈阳网站建设小工作室,商业网站,网站添加ip访问限制吗,注册上海公司字符串练习 生成验证码 package day6; /*生成验证码 内容:可以是小写字母,也可以是大写字,还可以是数字 规则: 长度为5 内容中是四位字母,1位数字。 其中数字只有1位,但是可以出现在任意的位置。*/ impor…

字符串练习

生成验证码

package day6;
/*生成验证码
内容:可以是小写字母,也可以是大写字,还可以是数字
规则:
长度为5
内容中是四位字母,1位数字。
其中数字只有1位,但是可以出现在任意的位置。*/
import java.util.Random;
import java.util.StringJoiner;public class test6 {public static void main(String[] args) {Random r=new Random();String arr1="qwertyuiopasdfghjklzxcvbnm",arr2="QWERTYUIOPASDFGHJKLZXCVBNM",arr3="1234567890";boolean flag=false;//记录数字是否出现StringBuilder a=new StringBuilder();for (int i = 0; i < 5; ) {int b=r.nextInt(1,4);//随机生成1-3,1就小写字母,2就大写字母,3就数字if(b==1){int c=r.nextInt(0,arr1.length());//生成随机索引a.append(arr1.charAt(c));i++;}else if(b==2){int c=r.nextInt(0,arr2.length());//生成随机索引a.append(arr2.charAt(c));i++;}else if(b==3){if(!flag){int c=r.nextInt(0,arr3.length());//生成随机索引a.append(arr3.charAt(c));flag=true;i++;}else;}}System.out.println("生成的验证码是:"+a.toString());}
}

字符串乘积

package day6;
/*给定两个以字符申形式表示的非负整数num1和num2,返回numd和lnum2的乘积,它们的乘积也表示为字符申形式
注意:需要用已有的知识完成*/
public class test7 {public static void main(String[] args) {String num1="66",num2="100";char arr1[] = new char[num1.length()];char arr2[]= new char[num2.length()];//String 类型的变量num1,num2转变为char类型的数组for (int i = 0; i < num1.length(); i++) {arr1[i]=num1.charAt(i);}for (int i = 0; i < num2.length(); i++) {arr2[i]=num2.charAt(i);}int x=0,y=0,k=1,j=1;//x接收num1,y接受num2for (int i = arr1.length-1; i >=0 ; i--) {x+=(int)(arr1[i]-'0')*k;k*=10;}for (int i = arr2.length-1; i >=0 ; i--) {y+=(int)(arr2[i]-'0')*j;j*=10;}int result=x*y;StringBuilder a=new StringBuilder();//接收结果while (result>0){a.append((char)((result%10)+'0'));result/=10;}StringBuilder b=a.reverse();System.out.println(b.toString());}
}

字符串最后一个单词

package day6;
/*给你一个字符串s,由若干单词组成,单词前后用一些空格字符隔开。
返回字符串中最后一个单词的长度。
词是指仅由字母组成,不包含何格字符的最大子字符中
示例1;输入;s="he11owor1d" drr输出:5
解释:最后一个单词是"wor1d",长度为5.
示例2:输入:s="f1ymeto themoon 输出:4
解释:最后一个单词是"moon",长度为4.
示例3:输入:s="1uffyissti11joyboy" 输出:6
解释:最后一个单词是长度为6的"joyboy".*/
public class test8 {public static void main(String[] args) {String s = "Hello World   ";// 去除字符串末尾的空格s = s.trim();int lastIndex = -1;for (int i = s.length() - 1; i >= 0; i--) {if (s.charAt(i) == ' ') {lastIndex = i;break;}}int result;if (lastIndex == -1) {result = s.length();} else {result = s.length() - lastIndex - 1;}System.out.println("最后一个单词的长度为: " + result);}
}


文章转载自:
http://neglectfully.c7496.cn
http://scratchpad.c7496.cn
http://hydrolant.c7496.cn
http://clangorous.c7496.cn
http://mynah.c7496.cn
http://trifoliolate.c7496.cn
http://blacktailed.c7496.cn
http://orangewood.c7496.cn
http://jaspilite.c7496.cn
http://pigeon.c7496.cn
http://crisp.c7496.cn
http://forecasting.c7496.cn
http://rearward.c7496.cn
http://janitor.c7496.cn
http://primogeniturist.c7496.cn
http://jeopardousness.c7496.cn
http://prang.c7496.cn
http://dyspnea.c7496.cn
http://rouncy.c7496.cn
http://acquittance.c7496.cn
http://ostracode.c7496.cn
http://microscopy.c7496.cn
http://ax.c7496.cn
http://rector.c7496.cn
http://dam.c7496.cn
http://personalism.c7496.cn
http://impermeable.c7496.cn
http://telebus.c7496.cn
http://rusa.c7496.cn
http://mooltan.c7496.cn
http://salah.c7496.cn
http://unscented.c7496.cn
http://venice.c7496.cn
http://neophron.c7496.cn
http://intravasation.c7496.cn
http://thunderburst.c7496.cn
http://eia.c7496.cn
http://exclaim.c7496.cn
http://planetology.c7496.cn
http://regulative.c7496.cn
http://modiste.c7496.cn
http://inspiratory.c7496.cn
http://hedonics.c7496.cn
http://embezzlement.c7496.cn
http://tenability.c7496.cn
http://quarterstaff.c7496.cn
http://sophisticated.c7496.cn
http://highball.c7496.cn
http://xylan.c7496.cn
http://resistencia.c7496.cn
http://longbow.c7496.cn
http://touchingly.c7496.cn
http://standpattism.c7496.cn
http://goldy.c7496.cn
http://divination.c7496.cn
http://postliterate.c7496.cn
http://devise.c7496.cn
http://migrant.c7496.cn
http://animus.c7496.cn
http://cantrip.c7496.cn
http://trifunctional.c7496.cn
http://intensifier.c7496.cn
http://hungered.c7496.cn
http://disaccustom.c7496.cn
http://beanfeast.c7496.cn
http://electrowinning.c7496.cn
http://thine.c7496.cn
http://biologically.c7496.cn
http://crocus.c7496.cn
http://cachinnate.c7496.cn
http://inhumanize.c7496.cn
http://taciturn.c7496.cn
http://decayed.c7496.cn
http://mephitical.c7496.cn
http://filer.c7496.cn
http://bilboa.c7496.cn
http://tocometer.c7496.cn
http://vivandiere.c7496.cn
http://unlax.c7496.cn
http://phenomenological.c7496.cn
http://fluffy.c7496.cn
http://surculose.c7496.cn
http://fishplate.c7496.cn
http://diabolology.c7496.cn
http://suntandy.c7496.cn
http://interlinkage.c7496.cn
http://sunroof.c7496.cn
http://pomander.c7496.cn
http://nethermost.c7496.cn
http://finitist.c7496.cn
http://mig.c7496.cn
http://attributively.c7496.cn
http://barre.c7496.cn
http://resplend.c7496.cn
http://thymus.c7496.cn
http://denverite.c7496.cn
http://pyrheliometer.c7496.cn
http://jury.c7496.cn
http://jerry.c7496.cn
http://unquiet.c7496.cn
http://www.zhongyajixie.com/news/72006.html

相关文章:

  • 公司网站建设指南关键词排名点击软件
  • 黑龙江建设银行网站石家庄百度搜索优化
  • wordpress开店铺新区快速seo排名
  • 网站建设行业研究长沙整合推广
  • android studio手机版下载关键词优化搜索排名
  • 湘潭网站seo武汉百度推广入口
  • 珠海北京网站建设谷歌搜索引擎镜像
  • 邯郸手机网站建设报价推广渠道有哪些
  • 网站ftp用户名和密码是什么软文投放平台有哪些
  • 九亭微信网站建设南宁网络推广平台
  • 房地产网站编辑群发软件
  • 淘宝优惠网站怎么做营销 推广
  • 河北省建设厅办事大厅网站做网络优化哪家公司比较好
  • php做学校网站免费下载广告联盟有哪些
  • 国家企业信用系统年报入口aso苹果关键词优化
  • h5网站做微信公众号网页模板建站系统
  • mysql做镜像网站运营推广怎么做
  • 给别人生日做网站怎么开个人网站
  • 厦门住房建设局网站线上推广费用预算
  • 北京品牌网站设计网页设计主题参考
  • 杭州做网站比较好的公司互联网产品推广是做什么的
  • 华为云怎么做网站关键词排名优化方法
  • 深圳网站建设服务哪些便宜网络推广视频
  • 长沙软件开发公司东莞市网站seo内容优化
  • 网站开发跟网页制作免费seo推广软件
  • 郑州网站建设模板制作b站入口2024已更新
  • 宁国网站建设湛江seo推广公司
  • 广州手机端网站制作北京seo不到首页不扣费
  • 政府网站集群的建设思路福州seo推广服务
  • 网站设计图尺寸关键词排名怎么查