⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 一个抓取程序
💻 JAVA
字号:
package com.phpcoo.test;

public class Test {

	String SplitStr;

	int SplitByte;

	public String operationStr(String str) {
		StringBuffer sb = new StringBuffer();
		int strLen = str.length();
		int startSite = str.indexOf("/*");
		int lastSite = str.lastIndexOf("*/");
		sb.append(str.substring(0, startSite));
		sb.append(str.substring(lastSite + 2, strLen));
		return sb.toString();
	}

	public  Test(String str, int bytes) {
		SplitStr = str;
		SplitByte = bytes;
		System.out.println("The String is:′" + SplitStr + "′;SplitBytes="
				+ SplitByte);
	}

	public void SplitIt()
	{   
		int loopCount;   
		loopCount=(SplitStr.length()%SplitByte==0)?(SplitStr.length()/SplitByte):(SplitStr.length()/SplitByte+1);  
		System.out.println("Will Split into "+loopCount);  
		for (int i=1;i<=loopCount ;i++ ) 
		{         
			if (i==loopCount)
			{           
				
				System.out.println(SplitStr.substring((i-1)*SplitByte,SplitStr.length())); 
				
			}
			else 
				{ 
					System.out.println(SplitStr.substring((i-1)*SplitByte,(i*SplitByte))); 
					
				}  
			} 
		}

	public static void main(String[] args) {
//		Test test = new Test();
//		System.out.println(test
//				.operationStr("dasdsad/**//**sdfsdfdsf**/**/fsdfsdf"));

		Test ss = new Test(
				"test中dd文dsaf中男大3443n中国43中国人 0ewldfls=103", 4);
		ss.SplitIt();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -