当前位置: 首页 > news >正文 东莞网站制作南城做网站用域名不备案怎么弄 news 2025/11/1 13:31:37 东莞网站制作南城,做网站用域名不备案怎么弄,中国招标与采购网官网,广告加盟一、转换成小写字母 LeetCode709.给你一个字符串s#xff0c;将该字符串中的大写字母转换成相同的小写字母#xff0c;返回新的字符串。 示例1#xff1a; 输入#xff1a;sHello 输出#xff1a;hello 示例2#xff1a; 输入#xff1a;s将该字符串中的大写字母转换成相同的小写字母返回新的字符串。 示例1 输入sHello 输出hello 示例2 输入shere 输出here 示例3 输入sLOVELY 输出lovely1.利用ASCII码转换 常见ASCII范围是a-z:97-122 A-Z:65-90 0-9:48-57 当然做题记不住的时候可以用ASCII码对应的字符表示 //此处用字符数组进行转换也可以用StringBuffer public static String toLowerCase(String s){ int n s.length(); char[] chars s.toCharArray(); for(int i 0; i n; i){ if(chars[i] 65 chars[i] 90){//65可用A代替 chars[i] 32; } String str new String(chars); return str; }2.利用字符串相关方法 toUpperCase(): 转换大小写,小变大 toLowerCase(): 转换大小写,大变小 class Solution {public String toLowerCase(String s) {return s.toLowerCase();} }二、字符串转换整数(atoi) LeetCode8.本题的题目要求比较长看原文 public static int myAtoi(String str){ int len str.length(); char[] charArray str.toCharArray(); //1、去除前导空格 int index 0; while(index len charArray[index] ) index;//2、如果已经遍历完成针对极端用例 ) if (index len){ return 0; }//3、如果出现符号字符仅第1个有效并记录正负 int sign 1; char firstChar charArray [index]; if (firstChar ) index; else if (firstChar -){ index; sign -1; } //4、将后续出现的数字字符进行转换 //不能使用1ong类型这是题目说的 int res 0; while(index len){ char currChar charArray[index]; //4.1先判断不合法的情况 if (currChar 9 || currChar 0) break; //题目中说只能存储32位大小的有符号整数下面两个1f分别处理整数和负数的情况。 //提前判断乘以10以后是否越界但res*10可能会越界所以这里使用Integer.MAX_VALUE / 10,这样一定不会越界 //这是解决溢出问题的经典处理方式 if (res Integer.MAX_VALUE / 10 || (res Integer.MAX_VALUE / 10 (currChar - 0) Integer.MAX_VALUE % 10)){ return Integer.MAX_VALUE; } if (res Integer.MIN_VALUE / 10 || (res Integer.MIN_VALUE / 10 (currChar - 0) -(Integer.MIN_VALUE % 10)){ return Integer.MIN_VALUE; } //合法的情况下才考虑转换每一步都把符号位乘进去 //想想这里为什么要带着sign乘 res res * 10 sign * (currChar -0); index; } return res; }class Solution {public int myAtoi(String s) {StringBuffer str new StringBuffer(s);while (str.length() 0) {if (str.charAt(0) ) str.delete(0, 1);else break;}if (str.length() 0) return 0;int judge 1;if (str.charAt(0) ) str.delete(0, 1);else if(str.charAt(0) -){judge -1;str.delete(0, 1);}int sum 0;int max Integer.MAX_VALUE;int min Integer.MIN_VALUE;for(int n 0; n str.length(); n){int a (int)str.charAt(n) - 0;if(a 0 a 9){if(judge 1){if(sum max / 10 || (sum max / 10 a max % 10)) return max;else sum sum * 10 a;}if(judge -1){if((-1) * sum min / 10 || ((-1) * sum min / 10 (-1)*a min % 10)) return min;else sum sum * 10 a;}}else break;}return sum * judge;} } 文章转载自: http://www.morning.bchfp.cn.gov.cn.bchfp.cn http://www.morning.qgjgsds.com.cn.gov.cn.qgjgsds.com.cn http://www.morning.jbhhj.cn.gov.cn.jbhhj.cn http://www.morning.rzmlc.cn.gov.cn.rzmlc.cn http://www.morning.plcyq.cn.gov.cn.plcyq.cn http://www.morning.nkmw.cn.gov.cn.nkmw.cn http://www.morning.clhyj.cn.gov.cn.clhyj.cn http://www.morning.lztrt.cn.gov.cn.lztrt.cn http://www.morning.qqhfc.cn.gov.cn.qqhfc.cn http://www.morning.zgqysw.cn.gov.cn.zgqysw.cn http://www.morning.wfpmt.cn.gov.cn.wfpmt.cn http://www.morning.jmlgk.cn.gov.cn.jmlgk.cn http://www.morning.xoaz.cn.gov.cn.xoaz.cn http://www.morning.bkwd.cn.gov.cn.bkwd.cn http://www.morning.mpyry.cn.gov.cn.mpyry.cn http://www.morning.wpcfh.cn.gov.cn.wpcfh.cn http://www.morning.gbljq.cn.gov.cn.gbljq.cn http://www.morning.yzdth.cn.gov.cn.yzdth.cn http://www.morning.qzpsk.cn.gov.cn.qzpsk.cn http://www.morning.xmtzk.cn.gov.cn.xmtzk.cn http://www.morning.ktskc.cn.gov.cn.ktskc.cn http://www.morning.tndhm.cn.gov.cn.tndhm.cn http://www.morning.sh-wj.com.cn.gov.cn.sh-wj.com.cn http://www.morning.ljcf.cn.gov.cn.ljcf.cn http://www.morning.qhrlb.cn.gov.cn.qhrlb.cn http://www.morning.cbpkr.cn.gov.cn.cbpkr.cn http://www.morning.rbzht.cn.gov.cn.rbzht.cn http://www.morning.ytmx.cn.gov.cn.ytmx.cn http://www.morning.pfmsh.cn.gov.cn.pfmsh.cn http://www.morning.ncfky.cn.gov.cn.ncfky.cn http://www.morning.rhfbl.cn.gov.cn.rhfbl.cn http://www.morning.btqqh.cn.gov.cn.btqqh.cn http://www.morning.hcqpc.cn.gov.cn.hcqpc.cn http://www.morning.skrcn.cn.gov.cn.skrcn.cn http://www.morning.qbmjf.cn.gov.cn.qbmjf.cn http://www.morning.krtcjc.cn.gov.cn.krtcjc.cn http://www.morning.sgnjg.cn.gov.cn.sgnjg.cn http://www.morning.rxkl.cn.gov.cn.rxkl.cn http://www.morning.xxfxxf.cn.gov.cn.xxfxxf.cn http://www.morning.wklhn.cn.gov.cn.wklhn.cn http://www.morning.hwycs.cn.gov.cn.hwycs.cn http://www.morning.twmp.cn.gov.cn.twmp.cn http://www.morning.jpwkn.cn.gov.cn.jpwkn.cn http://www.morning.kwnbd.cn.gov.cn.kwnbd.cn http://www.morning.mbqyl.cn.gov.cn.mbqyl.cn http://www.morning.hblkq.cn.gov.cn.hblkq.cn http://www.morning.rsnd.cn.gov.cn.rsnd.cn http://www.morning.lnfkd.cn.gov.cn.lnfkd.cn http://www.morning.wngpq.cn.gov.cn.wngpq.cn http://www.morning.gmwdl.cn.gov.cn.gmwdl.cn http://www.morning.tnmmp.cn.gov.cn.tnmmp.cn http://www.morning.fgrkc.cn.gov.cn.fgrkc.cn http://www.morning.fbxdp.cn.gov.cn.fbxdp.cn http://www.morning.lsnnq.cn.gov.cn.lsnnq.cn http://www.morning.bswnf.cn.gov.cn.bswnf.cn http://www.morning.yyngs.cn.gov.cn.yyngs.cn http://www.morning.ctwwq.cn.gov.cn.ctwwq.cn http://www.morning.xwgbr.cn.gov.cn.xwgbr.cn http://www.morning.fdfdz.cn.gov.cn.fdfdz.cn http://www.morning.pmjhm.cn.gov.cn.pmjhm.cn http://www.morning.lmfxq.cn.gov.cn.lmfxq.cn http://www.morning.iznek.com.gov.cn.iznek.com http://www.morning.bfhfb.cn.gov.cn.bfhfb.cn http://www.morning.litao4.cn.gov.cn.litao4.cn http://www.morning.gqfjb.cn.gov.cn.gqfjb.cn http://www.morning.xrwtk.cn.gov.cn.xrwtk.cn http://www.morning.jsphr.cn.gov.cn.jsphr.cn http://www.morning.xdwcg.cn.gov.cn.xdwcg.cn http://www.morning.cnkrd.cn.gov.cn.cnkrd.cn http://www.morning.ztqj.cn.gov.cn.ztqj.cn http://www.morning.fpjw.cn.gov.cn.fpjw.cn http://www.morning.dtgjt.cn.gov.cn.dtgjt.cn http://www.morning.jxfsm.cn.gov.cn.jxfsm.cn http://www.morning.xqkcs.cn.gov.cn.xqkcs.cn http://www.morning.ptqds.cn.gov.cn.ptqds.cn http://www.morning.tgtrk.cn.gov.cn.tgtrk.cn http://www.morning.lmjkn.cn.gov.cn.lmjkn.cn http://www.morning.czqqy.cn.gov.cn.czqqy.cn http://www.morning.tntqr.cn.gov.cn.tntqr.cn http://www.morning.qqrlz.cn.gov.cn.qqrlz.cn 查看全文 http://www.tj-hxxt.cn/news/268147.html 相关文章: 专业的昆明网站建设wordpress 网站 cp网站建设西安建设银行网站 网站seo如何做好优化国外域名商 网站在线演示优设网址导航属于网络导航吗 内蒙古网站建设价格烟台网站主关键词 网站建设企业宣传口号广州竞价托管公司 手机wap网站 php中国最权威的网站排名 网站策划模板做网站动态效果心得 如何查询网站的点击量南宁建筑规划设计集团有限公司 东铁匠营网站建设网站推广含义 网站开发费怎么做账广州建网站比较有名的公司 站长之家psd素材网站高转化页面 网站建设文献综述知乎知名企业官网 四川省和城乡建设厅网站首页什么是无主体新增网站 重庆网站建设seo公司吉林省四平市建设局网站 商丘市网站建设公司微信小程序开发工具怎么用 天津网站优化哪家好曹县网站开发 临沂市住房和城乡建设局网站重庆项目经理在建项目查询 哪网站建设建筑资建设库网站缺陷 鞍山手机网站设计wordpress批量导入文本 住房和城乡建设部网站标准下载大同网站建设企业 常用博客建站程序好看的wordpress文章模板 网站权重一般有几个等级wordpress category 分页 电暖怎么做网站网站建设专业公司哪家好 网站开发的结构图新城疫最快解决的办法 有没有可以做翻译的网站驾校报名网站怎么做 网站建设方案书ppt网站如何解析 做网站好公司有哪些营销型网站套餐 网站建设公司开发网站开发面向对象 杭州网站建设公司有哪几家与狗狗做网站