Android Open Source - BarcodeTest Parser






From Project

Back to project page BarcodeTest.

License

The source code is released under:

Copyright (c) 2014, zhongwcool All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * R...

If you think the Android project BarcodeTest listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 * // w ww.  j a v a  2s  .c  o m
 */
package com.qr.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author alex.zhong
 *
 */
public final class Parser {

  /**
   * @param args
   */
  
  public static List<String> urlParser(String textInfo){
    Pattern pattern = Pattern.compile("((http|ftp|https)://)[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/~\\+#])?" );
        Matcher matcher = pattern.matcher(textInfo);
        List<String> urlList = new ArrayList<String>();
        while(matcher.find()){              
          urlList.add(matcher.group());
        }   
        
    return urlList;
    
  }
  
  public static List<String> phoneParser(String textInfo){
    Pattern pattern = Pattern.compile("(?<!\\d)(?:(?:1[35]\\d{9})|(?:0[1-9]\\d{1,2}-?\\d{7,8}))(?!\\d)");
    Matcher matcher = pattern.matcher(textInfo);
    
    List<String> phoneList = new ArrayList<String>();
        while(matcher.find()){              
          phoneList.add(matcher.group());
        }   
        
    return phoneList;
    
  }

}




Java Source Code List

com.qr.activity.MainActivity.java
com.qr.activity.SearchResultActivity.java
com.qr.activity.WebviewActivity.java
com.qr.utils.Parser.java
com.zxing.activity.CaptureActivity.java
com.zxing.camera.AutoFocusCallback.java
com.zxing.camera.CameraConfigurationManager.java
com.zxing.camera.CameraManager.java
com.zxing.camera.FlashlightManager.java
com.zxing.camera.PlanarYUVLuminanceSource.java
com.zxing.camera.PreviewCallback.java
com.zxing.decoding.CaptureActivityHandler.java
com.zxing.decoding.DecodeFormatManager.java
com.zxing.decoding.DecodeHandler.java
com.zxing.decoding.DecodeThread.java
com.zxing.decoding.FinishListener.java
com.zxing.decoding.InactivityTimer.java
com.zxing.decoding.Intents.java
com.zxing.encoding.EncodingHandler.java
com.zxing.view.ResultUrlAdapter.java
com.zxing.view.Utility.java
com.zxing.view.ViewfinderResultPointCallback.java
com.zxing.view.ViewfinderView.java