zoukankan      html  css  js  c++  java
  • 数字与字母分割+

     1 public class Main{
     2     public static void main(String args[]){
     3         String s="ahkjdfnajk321anbkjdfbnjakfdkja4213746187";
     4         s=s+".";
     5         int n=s.length();
     6         char a[]=new char[n];
     7         a=s.toCharArray();
     8         int start=-1;
     9         int end=-1;
    10         for(int i=1;i<n;i++){
    11             if(a[i]>=48 && a[i]<=57 && (a[i-1] < 48 || a[i-1] > 57)){
    12                 a[i-1]='^';
    13             }
    14             if(a[i]>=48 && a[i]<=57 && (a[i+1] < 48 || a[i+1] > 57)){
    15                 a[i+1]='^';
    16             }
    17         }
    18         s=String.valueOf(a);
    19         String aa[]=s.split("\^");
    20         int count[]=new int[aa.length];
    21         for (int i = 0 ; i <aa.length ; i++ ){
    22             int nn=aa[i].length();
    23             char aaa[]=new char[nn];
    24             aaa=aa[i].toCharArray();
    25             for(int j=0;j<nn;j++){
    26                 if(aaa[j]>=48 && aaa[j]<=57){
    27                     count[i]++;
    28                 }
    29             }
    30         } 
    31         String ss=null;
    32         for(int i=0;i<aa.length;i++){
    33             if(count[i]>6){
    34                 ss=aa[i];
    35             }
    36         }
    37         System.out.println(ss);
    38     }
    39 }

  • 相关阅读:
    Linux 常用命令
    Oracle DG 三种模式(转)
    S5PV2210
    Timer wheel etc.
    SCM etc.
    负载均衡 IO etc.
    Remoting,OData Snippet Compiler等
    displaytag 动态列实现
    <display:column>属性解释
    <display:table>属性解释
  • 原文地址:https://www.cnblogs.com/DixinFan/p/9545375.html
Copyright © 2011-2022 走看看