菜单

金沙国际棋牌下载官网JSP中的字符替换函数 str

2020年1月29日 - 金沙国际唯一官网

//
// StrReplace.java
//
package forum;
import java.util.*;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;

/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/

public class MakeXml {
private final static String rootPath =
“D:\layoutroot\values-{0}x{1}\”;

public class StrReplace {

private final static float dw = 320f;
private final static float dh = 480f;

public StrReplace() {
}
public String str_replace(String from,String to,String source)
{
StringBuffer bf= new StringBuffer(“”);
StringTokenizer st = new StringTokenizer(source,from,true);
while (st.hasMoreTokens())
{
String tmp = st.nextToken();
System.out.println(“*”+tmp);
if(tmp.equals(from))
{
bf.append(to);
}
else
{
bf.append(tmp);
}
}
return bf.toString();
}
}

private final static String WTemplate = “<dimen
name=”x{0}”>{1}px</dimen>n”;
private final static String HTemplate = “<dimen
name=”y{0}”>{1}px</dimen>n”;

// 使用方法
<jsp:useBean id=”replace” scope=”page” class=”forum.StrReplace”
/>
<%= replace.str_replace(“<“,”^”,”<h1>123456</h1>”)
%> 

public static void main(String[] args) {
makeString(320, 480);
makeString(480, 800);
makeString(480, 854);
makeString(540, 960);
makeString(600, 1024);
makeString(720, 1184);
makeString(720, 1196);
makeString(720, 1280);
makeString(768, 1024);
makeString(800, 1280);
makeString(1080, 1812);
makeString(1080, 1920);
makeString(1440, 2560);
}

public static void makeString(int w, int h) {

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图