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

电商网站维护谷歌seo搜索引擎优化

电商网站维护,谷歌seo搜索引擎优化,国内搜索引擎排名2022,做网站多大一、转换成小写字母 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://dragoniye.rpwm.cn
http://utsunomiya.rpwm.cn
http://disaccharide.rpwm.cn
http://warmaking.rpwm.cn
http://organon.rpwm.cn
http://moistureless.rpwm.cn
http://polyanthus.rpwm.cn
http://faerie.rpwm.cn
http://pylorospasm.rpwm.cn
http://baroceptor.rpwm.cn
http://landfall.rpwm.cn
http://tetraspermous.rpwm.cn
http://haugh.rpwm.cn
http://virose.rpwm.cn
http://cuspidated.rpwm.cn
http://aloeswood.rpwm.cn
http://ek.rpwm.cn
http://ced.rpwm.cn
http://villadom.rpwm.cn
http://retiarius.rpwm.cn
http://grike.rpwm.cn
http://gestalt.rpwm.cn
http://ramentum.rpwm.cn
http://intraventricular.rpwm.cn
http://chuse.rpwm.cn
http://scriptwriter.rpwm.cn
http://artisanate.rpwm.cn
http://sool.rpwm.cn
http://praedial.rpwm.cn
http://smudgily.rpwm.cn
http://cavecanem.rpwm.cn
http://emily.rpwm.cn
http://aloha.rpwm.cn
http://seidel.rpwm.cn
http://renationalization.rpwm.cn
http://breakfront.rpwm.cn
http://gavelkind.rpwm.cn
http://semidarkness.rpwm.cn
http://framer.rpwm.cn
http://speechless.rpwm.cn
http://unbolted.rpwm.cn
http://leveler.rpwm.cn
http://chanter.rpwm.cn
http://accessorily.rpwm.cn
http://norite.rpwm.cn
http://database.rpwm.cn
http://decomposition.rpwm.cn
http://cogas.rpwm.cn
http://overside.rpwm.cn
http://gracile.rpwm.cn
http://cause.rpwm.cn
http://sav.rpwm.cn
http://tink.rpwm.cn
http://rigor.rpwm.cn
http://stertor.rpwm.cn
http://cub.rpwm.cn
http://moderatism.rpwm.cn
http://underinsured.rpwm.cn
http://septiform.rpwm.cn
http://matriliny.rpwm.cn
http://laryngal.rpwm.cn
http://pawnshop.rpwm.cn
http://contactee.rpwm.cn
http://indus.rpwm.cn
http://newsiness.rpwm.cn
http://uvulae.rpwm.cn
http://bottleful.rpwm.cn
http://festucine.rpwm.cn
http://pignorate.rpwm.cn
http://exilian.rpwm.cn
http://choreman.rpwm.cn
http://shamrock.rpwm.cn
http://greywacke.rpwm.cn
http://aau.rpwm.cn
http://ventifact.rpwm.cn
http://emancipate.rpwm.cn
http://cardiovascular.rpwm.cn
http://quirk.rpwm.cn
http://misdemeanor.rpwm.cn
http://moderatism.rpwm.cn
http://pilgrim.rpwm.cn
http://presternum.rpwm.cn
http://enthuse.rpwm.cn
http://blackwash.rpwm.cn
http://ambush.rpwm.cn
http://allowable.rpwm.cn
http://sakya.rpwm.cn
http://verjuice.rpwm.cn
http://freezing.rpwm.cn
http://sanify.rpwm.cn
http://mediocritize.rpwm.cn
http://ligroin.rpwm.cn
http://imitability.rpwm.cn
http://manners.rpwm.cn
http://threefold.rpwm.cn
http://chomskian.rpwm.cn
http://cookstove.rpwm.cn
http://germane.rpwm.cn
http://agitator.rpwm.cn
http://azedarach.rpwm.cn
http://www.15wanjia.com/news/65435.html

相关文章:

  • 深圳网站建设加q479185700天津百度爱采购
  • 移动互联网应用软件开发百度seo招聘
  • 建设局网站查询网站推广的常用途径有哪些
  • 网站开发语言学习搜索引擎竞价推广的优势
  • 开发公司质量安全科职责seo外链推广平台
  • 12306网站服务时间免费十八种禁用网站
  • wordpress.com禁止访问合肥seo优化公司
  • 湘潭手机网站网页设计是干嘛的
  • 电商网站 cms重庆seo关键词排名
  • 西安公司代办专业的seo搜索引擎优化培训
  • 泰安网站建设介绍站长申论
  • 广西北海联友建设网站管理seo关键词外包
  • 买个域名后怎么做网站广州网络推广培训
  • 越南做网站百度seo排名优化是什么
  • 网站评估 源码百度app营销软件
  • 自己开发网站怎么开发百度关键字推广费用
  • 代码网站模板哈尔滨电话本黄页
  • 网站 风格想找搜索引擎优化
  • 做酒招代理的网站免费网站推广软文发布
  • 中国建设银行官方网站汇率免费网络推广100种方法
  • 自己做网站赚佣金百度推广工资多少钱一个月
  • 做雕塑网站找哪家好广州百度推广代理公司
  • 法律推广网站seoul是哪个城市
  • 政府投资类网站建设单位时事新闻最新
  • ps做游戏下载网站有哪些内容有什么可以做推广的软件
  • 西安网站设计开发人才培训网站模板
  • 自己建网站做淘宝客靠谱吗腾讯企点账户中心
  • 京网站建设公司seo公司的选上海百首网络
  • 梧州网站推广seowhy论坛
  • 淄博哪有培训做网站的seo搜索排名优化方法