Java 基于这六个字符拆分字符串0102**

Java 基于这六个字符拆分字符串0102**,java,jakarta-ee,Java,Jakarta Ee,如何基于0102**拆分扁平字符串?字符串标记器仅适用于**。有没有办法根据0102**进行拆分?请建议 这是我的完整方法 private String handleCibil(InterfaceRequestVO ifmReqDto, String szExtIntType) throws MalformedURLException, org.apache.axis.AxisFault, RemoteException { /* Declaration and initiliazat

如何基于
0102**
拆分扁平字符串?字符串标记器仅适用于
**
。有没有办法根据
0102**
进行拆分?请建议

这是我的完整方法

private String handleCibil(InterfaceRequestVO ifmReqDto, String szExtIntType) throws MalformedURLException, org.apache.axis.AxisFault, RemoteException {

    /* Declaration and initiliazation */
    ConfVO confvo = ifmReqDto.getExtConfVo();
    String szResponse = null;
    String cibilResponse = null;        
    String errorResponse = null;
    String endpointURL = null;
    long timeOut = confvo.getBurMgr().getBurInfo(szExtIntType).getTimeOut();
    endpointURL = formWebServiceURL(confvo, szExtIntType);
    URL url = new URL(endpointURL);



    log.debug("Input xml for cibil "+ifmReqDto.getIfmReqXML());
    BasicHttpStub stub= new BasicHttpStub(url,new org.apache.axis.client.Service());
   szResponse = stub.executeXMLString(ifmReqDto.getIfmReqXML());





    //szResponse=szResponse.replaceAll("&", "&");
     log.debug("szResponse "+szResponse);

    /* Validate if the obtained response is as expected by IFM */
    try {

        extDao = new ExtInterfaceXMLTransDAO(ifmReqDto.getSemCallNo(), ifmReqDto.getIdService());
        extDao.updateRqstRespXML10g(ifmReqDto.getInterfaceReqNum(), szResponse, GGIConstants.IFM_RESPONSE);

        //log.debug("CIBIL_RESPONSE_XPATH " + GGIConstants.CIBIL_RESPONSE_XPATH);
        Document xmlDocument = DocumentHelper.parseText(szResponse);
        String xPath = GGIConstants.RESPONSE_XPATH;
        List<Node> nodes = xmlDocument.selectNodes(xPath);
        for (Node node : nodes) {
            String keyValue = node.valueOf(GGIConstants.RESPONSE_XPATH_KEY);
           // log.debug("keyValue : " + keyValue);

            if (keyValue.equalsIgnoreCase(GGIConstants.RESPONSE_XPATH_KEY_VALUE)) {
             //   log.debug("node value  : " + node.getText());
                cibilResponse = node.getText();
            }
        }
        log.debug("cibilResponse " + cibilResponse);

        String errorResponseXPATH = GGIConstants.CIBIL_ERROR_RESPONSE_XPATH;
        List<Node> errorResponseNode = xmlDocument.selectNodes(errorResponseXPATH);
         for (Node node : errorResponseNode) {               
                errorResponse = node.getText();

        }
        log.debug("errorResponse " + errorResponse);

      if(cibilResponse!=null && cibilResponse.length()>0)
      {
           StringTokenizer cibilResponseResults = new StringTokenizer(cibilResponse,"**");

           String tempResponse="";
           ArrayList probableMatchList = new ArrayList();
            while (cibilResponseResults.hasMoreElements()) {

                tempResponse = (String) cibilResponseResults.nextElement();
                if(tempResponse.length()>=80)
                {   
                    String memberRefNo = tempResponse.substring(69, 80).replaceAll(" ", "");
                    log.debug("memberRefNo " + memberRefNo);

                    if (memberRefNo.length() > 0) {
                        if (Integer.parseInt(memberRefNo) > 0) {
                            cibilResponse = tempResponse;
                            cibilResponse = cibilResponse+"**";
                        }
                        else
                        {
                            probableMatchList.add(tempResponse+"**");
                        }
                    }
                    else
                    {
                        probableMatchList.add(tempResponse+"**");
                    }
                }
                else
                {
                    cibilResponse = tempResponse+"**";
                }
            }

            log.debug("After finding the Member reference number cibilResponse " + cibilResponse);
            log.debug("After finding the Probable reference list " + probableMatchList);
            // TKN 008 
        cibilResponse=StringEscapeUtils.unescapeXml(cibilResponse).replaceAll("[^\\x20-\\x7e]","");
            ifmReqDto.setIfmTransformedResult(cibilResponse);
            ifmReqDto.setProbableMatchList(probableMatchList);    
      }   
       if (errorResponse!=null && errorResponse.length()>0) {
            throw new GenericInterfaceException(errorResponse
                    + " for the seq_request " + ifmReqDto.getSeqRequest() + " Seq_Interface_req is >> "
                    + ifmReqDto.getInterfaceReqNum(),
                    GGIConstants.SEND_REQUEST_CONSTANT + Strings.padStart(String.valueOf(ifmReqDto.getIdService()), 2, GGIConstants.DEFAULT_NUMBER_STRING)
                    + GGIConstants.CIBIL_ERROR_CODE);
        }
       else if (cibilResponse==null || StringUtils.isEmpty(cibilResponse) ) {
            throw new GenericInterfaceException("Cibil TUEF response is empty >> cibil Service "
                    + "for the seq_request " + ifmReqDto.getSeqRequest() + "Seq_Interface_req is >> "
                    + ifmReqDto.getInterfaceReqNum(),
                    GGIConstants.SEND_REQUEST_CONSTANT + Strings.padStart(String.valueOf(ifmReqDto.getIdService()), 2, GGIConstants.DEFAULT_NUMBER_STRING)
                    + GGIConstants.INTERFACE_ERROR_RESPONSE);
        }
            /* Setting Instinct response to ifmReqDto object */
    } catch (SQLException e) {
        log.error("SQLException while connecting to DataBase. Exception message is  ", e);
        throw new GenericInterfaceException("SQLException >> Instinct Service "
                + "for the seq_request " + ifmReqDto.getSeqRequest() + "Seq_Interface_req is >> "
                + ifmReqDto.getInterfaceReqNum(),
                GGIConstants.SEND_REQUEST_CONSTANT + Strings.padStart(String.valueOf(ifmReqDto.getIdService()), 2, GGIConstants.DEFAULT_NUMBER_STRING)
                + GGIConstants.DB_OPERATION_ERROR);
    } catch (GenericInterfaceException exp) {
        log.error("Exception occured while valid:", exp);
        throw exp;

    } catch (Exception exp) {
        log.error("Exception occured while valid:", exp);
        throw new GenericInterfaceException("GeneralException >> Instinct Service "
                + "for the seq_request " + ifmReqDto.getSeqRequest() + "Seq_Interface_req is >> "
                + ifmReqDto.getInterfaceReqNum(),
                GGIConstants.SEND_REQUEST_CONSTANT + Strings.padStart(String.valueOf(ifmReqDto.getIdService()), 2, GGIConstants.DEFAULT_NUMBER_STRING)
                + GGIConstants.UNKNOWN_ERROR);

    }
    return szResponse;
}
private String handleCibil(InterfaceRequestVO ifmReqDto,String szdequettype)抛出畸形异常异常,org.apache.axis.AxisFault,RemoteException{
/*声明和初始化*/
ConfVO ConfVO=ifmReqDto.getExtConfVo();
字符串szResponse=null;
字符串cibilResponse=null;
字符串errorResponse=null;
字符串endpointURL=null;
长超时=confvo.getBurMgr().getBurInfo(szdemittype.getTimeOut();
endpointURL=formWebServiceURL(confvo,szExiteType);
URL URL=新URL(端点URL);
debug(“cibil的输入xml”+ifmReqDto.getIfmReqXML());
BasicHttpStub=newBasicHttpStub(url,new org.apache.axis.client.Service());
szResponse=stub.executeXMLString(ifmReqDto.getIfmReqXML());
//szResponse=szResponse.replaceAll(&,“&;”);
log.debug(“szResponse”+szResponse);
/*验证获得的响应是否符合IFM的预期*/
试一试{
extDao=new exiteterfacexmltrandao(ifmReqDto.getSemCallNo(),ifmReqDto.getIdService());
updateRqstRespXML10g(ifmReqDto.getInterfaceReqNum(),szResponse,GGIConstants.IFM_RESPONSE);
//log.debug(“CIBIL_RESPONSE_XPATH”+GGIConstants.CIBIL_RESPONSE_XPATH);
Document xmlDocument=DocumentHelper.parseText(szResponse);
字符串xPath=GGIConstants.RESPONSE_xPath;
List nodes=xmlDocument.selectNodes(xPath);
用于(节点:节点){
String keyValue=node.valueOf(GGIConstants.RESPONSE\u XPATH\u KEY);
//log.debug(“keyValue:+keyValue”);
if(keyValue.equalsIgnoreCase(GGIConstants.RESPONSE\u XPATH\u KEY\u VALUE)){
//debug(“节点值:+node.getText());
cibilResponse=node.getText();
}
}
log.debug(“cibilResponse”+cibilResponse);
字符串errorResponseXPATH=GGIConstants.CIBIL\u ERROR\u RESPONSE\u XPATH;
列出errorResponseNode=xmlDocument.selectNodes(ErrorResponseExpath);
对于(节点:errorResponseNode){
errorResponse=node.getText();
}
log.debug(“errorResponse”+errorResponse);
if(cibilResponse!=null&&cibilResponse.length()>0)
{
StringTokenizer cibilResponseResults=新的StringTokenizer(cibilResponse,“**”);
字符串tempResponse=“”;
ArrayList probableMatchList=新的ArrayList();
while(cibilResponseResults.hasMoreElements()){
tempResponse=(字符串)cibilResponseResults.nextElement();
if(tempResponse.length()>=80)
{   
String memberRefNo=tempResponse.substring(69,80).replaceAll(“,”);
log.debug(“memberRefNo”+memberRefNo);
如果(memberRefNo.length()>0){
if(Integer.parseInt(memberRefNo)>0){
cibilResponse=tempResponse;
cibilResponse=cibilResponse+“**”;
}
其他的
{
添加(tempResponse+“**”);
}
}
其他的
{
添加(tempResponse+“**”);
}
}
其他的
{
cibilResponse=tempResponse+“**”;
}
}
log.debug(“找到成员参考号cibilResponse后”+cibilResponse);
log.debug(“找到可能参考列表后”+可能匹配列表);
//TKN 008
cibilResponse=StringEscapeUtils.unescapeXml(cibilResponse.replaceAll(“[^\\x20-\\x7e]”,”);
ifmReqDto.setIfmTransformedResult(cibilResponse);
ifmReqDto.setProbableMatchList(probableMatchList);
}   
if(errorResponse!=null&&errorResponse.length()>0){
抛出新的GenericInterfaceException(errorResponse
+“对于seq_请求”+ifmReqDto.getSeqRequest()+“seq_接口_请求为>>”
+ifmReqDto.getInterfaceReqNum(),
GGIConstants.SEND\u REQUEST\u常量+Strings.padStart(String.valueOf(ifmReqDto.getIdService()),2,GGIConstants.DEFAULT\u NUMBER\u字符串)
+GGIConstants.CIBIL_错误代码);
}
else if(cibilResponse==null | | StringUtils.isEmpty(cibilResponse)){
抛出新的GenericInterfaceException(“Cibil TUEF响应为空>>Cibil服务”
+“对于seq_请求”+ifmReqDto.getSeqRequest()+“seq_接口_请求为>>”
+ifmReqDto.getInterfaceReqNum(),
GGIConstants.SEND\u REQUEST\u常量+Strings.padStart(String.valueOf(ifmReqDto.getIdService()),2,GGIConstants.DEFAULT\u NUMBER\u字符串)
+GGIConstants.接口错误(响应);
}
/*设置ifmReqDto对象的本能响应*/
}捕获(SQLE异常){
log.error(“连接数据库时发生SQLException,异常消息为”,e);
抛出新的GenericInterfaceException(“SQLException>>本能服务”
+“对于seq_请求”+ifmReqDto.getSeqRequest()+“seq_接口_请求为>>”
+ifmReqDto.getInterfaceReqNum(),
GGIConstants.SEND\u REQUEST\u常量+Strings.padStart(String.valueOf(ifmReqDto.getIdService()),2,GGIConstants.DEFAULT\u NUMBER\u字符串)
+GGIConstants.DB_操作错误);
}捕获(GenericInterfaceException exp){
log.error(“有效时发生异常:”,exp);
String[] tokens = myString.split("0102\\*\\*");
String string = "blabla0102**dada";
String[] parts = string.split("0102\\*\\*");
String part1 = parts[0]; // blabla
String part2 = parts[1]; // dada
String[] resutl = yourString.split("0102\\*\\*");
String[] resutl = yourString.split("0102..");
String[] resutl = yourString.split("0102\\d\\d");
    String[] tokens = "My text 0102** hello!".split("0102\\*\\*");
    System.out.println(tokens[0]);
    System.out.println(tokens[1]);