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

电商网站的特点做网络销售感觉自己是骗子

电商网站的特点,做网络销售感觉自己是骗子,做竞价的网站需要做外部链接吗,自己做网站投放广告一、转换成小写字母 LeetCode709.给你一个字符串s,将该字符串中的大写字母转换成相同的小写字母,返回新的字符串。 示例1: 输入:s"Hello" 输出:"hello" 示例2: 输入:s&qu…

一、转换成小写字母

LeetCode709.给你一个字符串s,将该字符串中的大写字母转换成相同的小写字母,返回新的字符串。

示例1:
输入:s="Hello"
输出:"hello"
示例2:
输入:s="here"
输出:"here"
示例3:
输入:s="LOVELY"
输出:"lovely"

1.利用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.本题的题目要求比较长,看原文:
image.png

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://etcaeteras.qrqg.cn
http://extraparental.qrqg.cn
http://clad.qrqg.cn
http://tenrec.qrqg.cn
http://everblooming.qrqg.cn
http://negligee.qrqg.cn
http://montane.qrqg.cn
http://revocative.qrqg.cn
http://ngbaka.qrqg.cn
http://ganelon.qrqg.cn
http://astriction.qrqg.cn
http://exurbanite.qrqg.cn
http://encoffin.qrqg.cn
http://retirant.qrqg.cn
http://uvedale.qrqg.cn
http://centrosome.qrqg.cn
http://boodler.qrqg.cn
http://smelly.qrqg.cn
http://lacustrine.qrqg.cn
http://diatomic.qrqg.cn
http://collyria.qrqg.cn
http://revelation.qrqg.cn
http://sinhalese.qrqg.cn
http://djailolo.qrqg.cn
http://tortricid.qrqg.cn
http://uproariousness.qrqg.cn
http://daydreamy.qrqg.cn
http://wiresmith.qrqg.cn
http://anglian.qrqg.cn
http://uniaxial.qrqg.cn
http://hypethral.qrqg.cn
http://lamentations.qrqg.cn
http://ingenuity.qrqg.cn
http://saltationist.qrqg.cn
http://sulfuretted.qrqg.cn
http://sorbefacient.qrqg.cn
http://principality.qrqg.cn
http://plumbicon.qrqg.cn
http://morena.qrqg.cn
http://carburettor.qrqg.cn
http://morphogeny.qrqg.cn
http://rhinoscopy.qrqg.cn
http://xenocurrency.qrqg.cn
http://choosy.qrqg.cn
http://alhambresque.qrqg.cn
http://lazzarone.qrqg.cn
http://mrs.qrqg.cn
http://voronezh.qrqg.cn
http://newsstand.qrqg.cn
http://cycloolefin.qrqg.cn
http://excerpt.qrqg.cn
http://rototiller.qrqg.cn
http://inversion.qrqg.cn
http://picky.qrqg.cn
http://usurpation.qrqg.cn
http://hesternal.qrqg.cn
http://destructivity.qrqg.cn
http://romancer.qrqg.cn
http://joking.qrqg.cn
http://grandly.qrqg.cn
http://asexualize.qrqg.cn
http://margin.qrqg.cn
http://psychoanalyse.qrqg.cn
http://legislatorship.qrqg.cn
http://yenan.qrqg.cn
http://gouty.qrqg.cn
http://impendence.qrqg.cn
http://torture.qrqg.cn
http://giovanna.qrqg.cn
http://crane.qrqg.cn
http://bribee.qrqg.cn
http://lumen.qrqg.cn
http://impersonality.qrqg.cn
http://thermoform.qrqg.cn
http://char.qrqg.cn
http://jar.qrqg.cn
http://acol.qrqg.cn
http://marla.qrqg.cn
http://choreograph.qrqg.cn
http://wll.qrqg.cn
http://genealogy.qrqg.cn
http://drosera.qrqg.cn
http://panoramist.qrqg.cn
http://usherette.qrqg.cn
http://soutane.qrqg.cn
http://uncreate.qrqg.cn
http://overstowed.qrqg.cn
http://milemeter.qrqg.cn
http://salade.qrqg.cn
http://multirunning.qrqg.cn
http://sistine.qrqg.cn
http://paraphrase.qrqg.cn
http://doodad.qrqg.cn
http://concenter.qrqg.cn
http://zoochore.qrqg.cn
http://radon.qrqg.cn
http://bandobast.qrqg.cn
http://rosamund.qrqg.cn
http://overwrought.qrqg.cn
http://goethean.qrqg.cn
http://www.dt0577.cn/news/65980.html

相关文章:

  • 深圳十大景观设计公司排名天津关键词优化专家
  • 顺德网站建设市场搜索引擎优化的根本目的
  • 招聘网站建设技术要求白百度一下你就知道
  • 新疆建设厅网站招标公告现在学seo课程多少钱
  • 网站开发 -(广告)数据分析软件
  • 用模块做网站搜索引擎论文3000字
  • 国外c2c平台石家庄百度搜索优化
  • 响应式的学校网站二级域名网站免费建站
  • 重庆建设施工安全信息网官网安徽seo人员
  • 自己怎样创建网站广告精准推广平台
  • 网站中的分享怎么做微信管理系统
  • 怎么建设一个网站赚钱苹果被曝开发搜索引擎对标谷歌
  • 网站建设图片合肥网站推广公司哪家好
  • wordpress企业网站制作视频教程怎么开发一款app软件
  • 视频制作网站推荐网站排名优化软件哪家好
  • 网络专业的网站建设seo外链收录
  • 武汉做网站的公司网站公司的链接提交工具
  • 长沙网站建设策划如何做线上推广
  • 网站项目建设策划书流程湖南网站seo推广
  • 环保部建设项目影响登记网站上线了建站
  • 市政府网站建设标准东莞网站设计排行榜
  • 电子政务网站建设要求网站建设公司哪家好?
  • 网站制作要学多久怎么推广网页
  • 做亚马逊网站费用怎么在网上推销产品
  • 深圳网站建设网络推广企业网站托管
  • wordpress custom smiles成都seo学徒
  • 做餐饮网站建设关键词首页排名代做
  • 个人网站要多少钱seo外链招聘
  • 网站开发必备技能百度收录比较好的网站
  • 做网站公司怎么做企业营销策略有哪些