package com.kzw.core.util;
// jcommon.java
//
// -------------------------------------------------------------------------
// This class is a container of common functions
// Usage:
// 1. Call the class methods: jcommon.pad(telcolsize, '0' -4)
// -------------------------------------------------------------------------
//
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.text.Collator;
import java.text.SimpleDateFormat;
import java.io.*;
public class FunctionsUtil implements Serializable{
// -----------------------------
// Pad function - CLASS METHOD
// -----------------------------
// This function pads a string up to the required length with the
// pad character specified.
// If len is negative, this function pads on the left
// -----------------------------
public static char crchar[] = { 0x0D, 0x0A };
public static String crlf = new String(crchar);
public static char cr = 0x0D;
public static char lf = 0x0A;
public static char quchar[] = { '"' };
public static char quBlank[] = { '"', '"' };
public static String quote = new String(quchar);
public static String blankQuote = new String(quBlank);
public static String fs = File.separator;
private static char[] hex40 = null;
static {
hex40 = new char[4000];
for (int i = 0; i < 4000; i++) {
hex40[i] = 0x40;
}
}
// chopstr
// This function chops a string up into strings tokens
public static String chopstr(String line, int maxlen) {
StringTokenizer strtoken = new StringTokenizer(line, " ", true);
int curlen = 0;
boolean firstoken = true;
String retline = "";
while (strtoken.hasMoreTokens()) {
String token = strtoken.nextToken();
curlen += token.length();
if (curlen <= maxlen | firstoken) {
retline += token;
} else {
retline += crlf + token;
curlen = token.length();
}
if (firstoken)
firstoken = false;
}
return retline;
}
public static String firstToUpperCase(String string) {
String post = string.substring(1, string.length());
String first = ("" + string.charAt(0)).toUpperCase();
return first + post;
}
// append one file to another
public static void copyAppend(String fromFile, String toFile)
throws IOException {
String lineIn;
PrintWriter out = new PrintWriter(new FileWriter(toFile, true));
BufferedReader in = new BufferedReader(new FileReader(fromFile));
while ((lineIn = in.readLine()) != null)
out.println(lineIn);
out.close();
in.close();
}
// convert from decimal string to hex string value
public static String d2x(String numstr, int precision, int scale) {
String retstr = "";
String signstr = "";
String pstr = "";
String sstr = "";
boolean beginscale = false;
char onechar;
if (numstr.indexOf("-") >= 0)
signstr = "D";
else
signstr = "C";
int strlen = numstr.length();
for (int i = 0; i < strlen; i++) {
onechar = numstr.charAt(i);
if (onechar == '+' || onechar == '-')
;
else if (onechar == '.')
beginscale = true;
else if (beginscale)
sstr += onechar;
else
pstr += onechar;
}
int diflen = precision - scale;
if (pstr.length() < diflen)
pstr = FunctionsUtil.Pad(pstr, '0', -1 * diflen);
// pad precision portion if precision is an even number
if ((precision % 2) == 0)
pstr = "0" + pstr;
if (sstr.length() < scale)
sstr = FunctionsUtil.Pad(sstr, '0', scale);
retstr = s2x(pstr + sstr + signstr);
return retstr;
}
public static int exp(int in, int power) {
int retval = in;
if (power > 0) {
for (int i = 1; i < power; i++) {
retval = retval * in;
}
} else
retval = 1;
return retval;
}
// return the argument, converted to upper case, at a specific position
// (counting from zero)
public static String getArg(String[] arg, int argNum) {
return ((argNum >= 0 && argNum < arg.length) ? arg[argNum]
.toUpperCase() : "");
}
// return the concatenation of arguments starting from a specific position
// to the last one
public static String getArg(String[] arg, int argNum, boolean lastArg) {
String retstr = "";
retstr = getArg(arg, argNum);
if (lastArg && argNum >= 0)
for (int i = argNum + 1; i < arg.length; i++)
retstr += " " + arg[i];
return retstr.toUpperCase();
}
/**
* This method was created in VisualAge.
*/
public static String getFmtString(String varName, String fmt) {
int numDigits = 0;
int numDecimals = 0;
StringTokenizer tline = new StringTokenizer(fmt, " (),");
String tokstr = "";
boolean isNumDigits = true;
while (tline.hasMoreTokens()) {
tokstr = tline.nextToken().trim();
try {
Integer num = new Integer(tokstr);
if (isNumDigits) {
numDigits = num.intValue();
isNumDigits = false;
} else
numDecimals = num.intValue();
} catch (Exception e) {
}
} // end while
return getFmtString(varName, numDigits, numDecimals);
}
// search an option from the options string and return the value given for
// that option termination by a " " or "/"
/**
* @param varName
* @param numDigits
* @param numDecimals
* @return
*/
public static String getFmtString(String varName, int numDigits,
int numDecimals) {
// the number in the data type DECIMAL(A,B) has A-B integer digits and B
// decimal digits
int numSig = numDigits - numDecimals;
StringBuffer retStr = new StringBuffer("");
int numThree = 0;
for (int c = 0; c < numSig; c++) {
if (numThree == 3) {
retStr.insert(0, ",");
numThree = 0;
}
if (c == 0)
retStr.insert(0, "0");
else
retStr.insert(0, "#");
++numThree;
}
for (int c = 0; c < numDecimals; c++) {
if (c == 0)
retStr.append(".0");
else
retStr.append("0");
}
return (" private static String " + varName + "Fmt " + " = "
+ FunctionsUtil.quote + retStr.toString() + FunctionsUtil.quote + ";");
}
public static String getFmtString(String varName, String digits,
String decimals) {
int numDigits = new Integer(digits).intValue();
int numDecimals = new Integer(decimals).intValue();
return getFmtString(varName, numDigits, numDecimals);
}
public static String getOpt(String options, String searchStr) {
String retstr = "";
int i = options.indexOf(searchStr);
if (i >= 0) {
int e = options.length();
int s = i + searchStr.length();
int temp = options.indexOf(' ', s);
if (temp >= 0 && temp < e)
e = temp;
temp = options.indexOf('/', s);
if (temp >= 0 && temp < e)
e = temp;
retstr = options.substring(s, e);
} // end if
return retstr;
}
// search parmStr for searchStr=value and return value if found, otherwise
// return blank
public static String getParameter(String parmStr, String searchStr,
String separator) {
String result = "";
if (searchStr == null || parmStr == null)
return result;
//
StringTokenizer tline = new StringTokenizer(parmStr, separator);
while (tline.hasMoreTokens()) {
String value = tline.nextToken().trim();
if (value.equals(searchStr)) {
if (tline.hasMoreTokens())
result = tline.nextToken().trim();
break;
}
}
return result;
}
/**
* This method was created in VisualAge.
*/
public static String getScale(String fmt) {
StringBuffer retStr = new StringBuffer("");
int numDigits = 0;
int numDecimals = 0;
StringTokenizer tline = new StringTokenizer(fmt, " (),");
String tokstr = "";
boolean isNumDigits = true;
while (tline.hasMoreTokens()) {
tokstr = tline.nextToken().trim();
try {
Integer num = new Integer(tokstr);
if (isNumDigits) {
numDigits = num.intValue();
isNumDigits = false;
} else
numDecimals = num.intValue();
} catch (Exception e) {
}
} // end while
Integer numDec = new Integer(numDecimals);
return (numDec.toString());
}
/**
* This method was created in VisualAge. Search and replace text in all
* files in a directory or a single file
*
没有合适的资源?快使用搜索试试~ 我知道了~
健身房管理系统
共1346个文件
js:416个
png:246个
class:107个
需积分: 37 61 下载量 194 浏览量
2018-06-25
11:02:56
上传
评论 9
收藏 38.47MB ZIP 举报
温馨提示
实现了对健身房器材,健身房会员以及会员课程有效管理。
资源推荐
资源详情
资源评论
收起资源包目录
健身房管理系统 (1346个子文件)
jquery.jqGrid.min.js.bak 515KB
FunctionsUtil.class 20KB
HibernateDao.class 19KB
SimpleHibernateDao.class 10KB
StringUtil.class 9KB
LunarCalendar.class 9KB
JsonMapper.class 8KB
JSON.class 8KB
FileAttachAction.class 8KB
BeanUtil.class 8KB
CertUtil.class 8KB
AssertUtils.class 7KB
CryptoUtils.class 7KB
MemberAction.class 7KB
EntityManager.class 7KB
ReflectionUtils.class 7KB
XmlUtil.class 7KB
DictionarySelectTag.class 6KB
ServletUtils.class 6KB
MenuService.class 5KB
StringPropertyFilter.class 5KB
LockersAction.class 5KB
EmployeeAction.class 5KB
AppUserAction.class 5KB
CardAction.class 5KB
Zipper.class 5KB
StrUtils.class 5KB
GoodsAction.class 5KB
Jackson.class 4KB
MenuAction.class 4KB
Page.class 4KB
RoleAction.class 4KB
DepartmentAction.class 4KB
PageRequest.class 4KB
Member.class 4KB
EncodeUtils.class 4KB
FileUtil.class 4KB
RequestUtil.class 3KB
Employee.class 3KB
DictionaryAction.class 3KB
DepartmentService.class 3KB
Num62.class 3KB
FileAttach.class 3KB
AppUser.class 3KB
BeanMapper.class 3KB
My_MD5.class 3KB
Collections3.class 3KB
GlobalType.class 3KB
Menu.class 3KB
DateUtil.class 3KB
Department.class 3KB
PropertiesUtils.class 3KB
SessionFilter.class 2KB
BeanValidators.class 2KB
Card.class 2KB
ParamUtil.class 2KB
DigestUtils.class 2KB
SpringContextHolder.class 2KB
HibernateWebUtil.class 2KB
GlobalTypeAction.class 2KB
Goods.class 2KB
Lockers.class 2KB
Zipper$FileEntry.class 2KB
PropertiesUtil.class 2KB
MD5.class 2KB
StringPropertyFilter$PropertyType.class 2KB
DictionaryService.class 2KB
ResponseUtils.class 2KB
NumberUtils.class 2KB
Dictionary.class 2KB
MemberService.class 2KB
CardService.class 2KB
ThreadUtils.class 2KB
UserSession.class 2KB
UUIDGenerator.class 2KB
Role.class 2KB
DefaultEntityManager.class 2KB
PropertyFilter.class 2KB
CertUtil$SavingTrustManager.class 1KB
ThreadUtils$CustomizableThreadFactory.class 1KB
MatchType.class 1KB
BeanDateConnverter.class 1KB
ObjectJson.class 1KB
Mixin.class 1KB
DatePropertyEditor.class 1KB
LockersService.class 1KB
Constants.class 1KB
Msg.class 966B
DateWebBindingInitializer.class 927B
IdUtils.class 861B
PageRequest$Sort.class 780B
ExceptionUtils.class 669B
GlobalTypeService.class 616B
FileAttachService.class 616B
AppUserService.class 604B
EmployeeService.class 599B
RoleService.class 592B
GoodsService.class 587B
Mixin$Mixin0.class 296B
Mixin$Mixin6.class 296B
共 1346 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
Vokes0069
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功