// 输入一行字符串,输出其中的整数 ,如 +1a2 输出12 import java.util.Scanner; public class test4 { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNextLine()) {//0 String input = in.nextLine(); String s = input.trim(); String res = ""; if(s!=null && !"".equals(s)){ for(int i=0;i<s.length();i++){ if(s.charAt(i)>=48 && s.charAt(i)<=57){ res += s.charAt(i); } } } System.out.println(res); }//0 } }
点赞 10

相关推荐

点赞 评论 收藏
分享
09-18 20:41
百度_Java
要个offer怎么这...:哈哈哈哈哈哈,我也拿了0x10000000个offer,秋招温啦啦啦,好开心
我的秋招日记
点赞 评论 收藏
分享
10-09 16:23
门头沟学院 Java
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务