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

📄 replace.java

📁 java 调用windows的api
💻 JAVA
字号:
package org.jawin.browser.util;

/**
 * <p>Title: Jawin Code Generation GUI</p>
 * <p>Description: GUI for exploring type libraries and generating Java code</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Open Source Incentive</p>
 * @author Josh Passenger
 * @version 1.0
 */

public class Replace extends Exception {

	public Replace()
	{
	}

	public static String replace(String raw, String replace, String with)
	{
		StringBuffer buffer = new StringBuffer();

		if (with.indexOf(replace) != -1)
		{
			throw new IllegalArgumentException("Replace.replace() the replacement (" + with + ") contains the String to replace (" + replace + ")");
		}

		int index = raw.indexOf(replace);

		while (index > -1)
		{
			buffer.setLength(0);
			buffer.append(raw.substring(0, index));
			buffer.append(with);
			buffer.append(raw.substring(index + replace.length()));
			raw = buffer.toString();
			index = raw.indexOf(replace);
		}

		return raw;
	}
}

⌨️ 快捷键说明

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