smsutils.java

来自「一个SMS 的短信平台的原代码」· Java 代码 · 共 35 行

JAVA
35
字号

package edu.soft.buaa.message.sms;

import java.io.*;
import java.util.*;
import java.text.*;

/**
	This class has some general purpose functions.
*/
public class SMSUtils
{
	/**
		String substitution routine.

		@param	text	the initial text.
		@param	symbol	the string to be substituted.
		@param	value	the string that the "symbol" will be substituted with, in the "text" (all occurences).

		@return	the changed text.
	*/
	public static String substituteSymbol(String text, String symbol, String value)
	{
		StringBuffer buffer;

		while (text.indexOf(symbol) >= 0)
		{
			buffer = new StringBuffer(text);
			buffer.replace(text.indexOf(symbol), text.indexOf(symbol) + symbol.length(), value);
			text = buffer.toString();
		}
		return text;
	}
}

⌨️ 快捷键说明

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