使用ueditor实现多图片上传案例——截取字符串层Util(SubString_text)

 /**  
* @Title: ConfigManager.java
* @Package org.util
* @Description: TODO该方法的主要作用:
* @author A18ccms A18ccms_gmail_com  
* @date 2017-9-29 上午8:01:39
* @version V1.0  
*/
package org.util;

import org.entity.Shopping;


 /**   
 *    
 * 项目名称:test_fuwenben   
 * 类名称:ConfigManager   
 * 类描述:   测试
 * 创建人:Mu Xiongxiong  
 * 创建时间:2017-9-29 上午8:01:39   
 * 修改人:Mu Xiongxiong   
 * 修改时间:2017-9-29 上午8:01:39   
 * 修改备注:   
 * @version    
 *    
 */
public class SubString_text {
		
	public static void SubString_text_picture(Object entity,String text) {
		
		Shopping shopping = (Shopping) entity;
//		text = "<p><img src=\"http://localhost:8080/test_fuwenben//ueditor/jsp/upload/image/20170930/1506774556153096952.jpg\" title=\"1506774556153096952.jpg\"/></p>" +
//				"<p><img src=\"http://localhost:8080/test_fuwenben//ueditor/jsp/upload/image/20170930/1506774556372013191.jpg\" " +
//				"title=\"1506774556372013191.jpg\"/></p><p><br/></p>";
		//截取p
		String subArray_p[] = new String []{};
		String s = new String(text);
		subArray_p = s.split("</p>");
		String picture = "";
		for (int i = 0; i < subArray_p.length; i++) {
			int title = subArray_p[i].indexOf("ueditor");
			int end = subArray_p[i].indexOf("title");
			if(title>0&&end>0){
				String picture_name = subArray_p[i].substring(title, end);
				picture+=picture_name+",";
			}
		}
		shopping.setPicture(picture);
		System.out.println("图片名称:"+picture);
	}
	
}

posted @ 2017-10-01 00:14  穆雄雄  阅读(114)  评论(0编辑  收藏  举报