当前位置:网站首页>分离字符串中的字母和数字并使得字母在前数组在后
分离字符串中的字母和数字并使得字母在前数组在后
2022-07-01 20:21:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
大搜车校招编程题:
分离字符串中的字母和数字并使得字母在前数组在后
public class 校招 {
static String stringCharFrontNumEnd(String string){
if(string==null ||string.length()==0)
return null;
String charString="";
String numString="";
for(int i=0;i<string.length();i++){
if(string.charAt(i)>='0' && string.charAt(i)<='9')
System.out.println(string.charAt(i));
numString=numString + string.charAt(i);
if(string.charAt(i)>='a' && string.charAt(i)<='z' || string.charAt(i)>='A' && string.charAt(i)<='Z')
charString= charString + string.charAt(i);
}
return charString+numString;
}
public static void main(String[] args) {
String string="h3a2p0p1y";
System.out.println(string + " --> " + stringCharFrontNumEnd(string));
}
}发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/147191.html原文链接:https://javaforall.cn
边栏推荐
- 杰理之烧录上层版物料需要【篇】
- 开环和闭环是什么意思?
- Data analysts sound tall? Understand these points before you decide whether to transform
- On the next generation entrance of the metauniverse -- the implementation of brain computer interface
- 在技术升级中迎合消费者需求,安吉尔净水器“价值战”的竞争之道
- Richview trvdocparameters page parameter settings
- Items in richview documents
- 宅男壁纸大全微信小程序源码-带动态壁纸支持多种流量主
- 朋友圈社区程序源码分享
- 联想电脑怎么连接蓝牙耳机?
猜你喜欢
随机推荐
杰理之烧录都使用 VBAT 供电,供电电压 4.2V【篇】
[multithreading] realize the singleton mode (hungry and lazy) realize the thread safe singleton mode (double validation lock)
RichView RichEdit SRichViewEdit PageSize 页面设置与同步
从20s优化到500ms,我用了这三招
leetcode刷题:栈与队列03(有效的括号)
想请教一下,券商选哪个比较好尼?本人小白不懂,现在网上开户安全么?
leetcode刷题:栈与队列05(逆波兰表达式求值)
Écrire un document de blog
三菱PLC FX3U脉冲轴点动功能块(MC_Jog)
宅男壁纸大全微信小程序源码-带动态壁纸支持多种流量主
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
300题线性代数 第四讲 线性方程组
2022年低压电工考试试题及答案
BPR(贝叶斯个性化排序)
EURA eurui E1000 series inverter uses PID to realize the relevant parameter setting and wiring of constant pressure water supply function
Using qeventloop to realize synchronous waiting for the return of slot function
Big factories are wolves, small factories are dogs?
新版图解网络PDF即将发布
如果浏览器被意外关闭,react怎么缓存用户填写的表单?









