当前位置:网站首页>Separate the letters and numbers in the string so that the letters come first and the array comes last
Separate the letters and numbers in the string so that the letters come first and the array comes last
2022-07-01 22:08:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Big search car school recruitment programming problem :
Separate the letters and numbers in the string and make the letters in the front and the array in the back
public class The school recruit {
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));
}
}
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/147191.html Link to the original text :https://javaforall.cn
边栏推荐
- AIDL基本使用
- Accelera Systems Initiative是一个独立的非营利组织
- pytest合集(2)— pytest運行方式
- 基础—io密集型计算和cpu密集型计算
- 函数基本学习之一
- [noip2013] building block competition [noip2018] road laying greed / difference
- An operation tool used by we media professionals who earn 1w+ a month
- 物联网rfid等
- LIS (longest ascending subsequence) problem that can be understood [easy to understand]
- 统计字符中每个字符出现的个数
猜你喜欢
随机推荐
leetcode刷题:二叉树03(二叉树的后序遍历)
基于K-means的用户画像聚类模型
Tops, the unit of computing power of the processor, can be carried out 1 trillion times per second
杰理之关于长按开机检测抬起问题【篇】
考虑关系的图卷积神经网络R-GCN的一些理解以及DGL官方代码的一些讲解
Application of real estate management based on 3D GIS
List announced | outstanding intellectual property service team in China in 2021
【直播回顾】战码先锋首期8节直播完美落幕,下期敬请期待!
vscode的使用
十三届蓝桥杯B组国赛
基于LSTM模型实现新闻分类
二叉树的基本操作
CNN卷积神经网络原理讲解+图片识别应用(附源码)[通俗易懂]
《QTreeView+QAbstractItemModel自定义模型》:系列教程之三[通俗易懂]
MySQL系列之事务日志Redo log学习笔记
[monomer] recommended configuration of streaming information i-bpsv3 server
K-means based user portrait clustering model
Manually implement function isinstanceof (child, parent)
收到一封CTO来信,邀约面试机器学习工程师
函数基本学习之一