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

📄 workflow_tools.java

📁 用java实现的工作流
💻 JAVA
字号:
package treedoc;

//工具类.从电子政务取过来,目前没有使用

/**
 * 名称       : WORKFLOW_TOOLS
 * 描述       : WWW.FANGFA.NET 工作流管理系统--工具类
 * 版权信息   : Copyright (c) 2004 COMSCI
 * @作者      : COMSCI Sichuan Fangfa Digital
 * @版本      : 0.9 builder 2004091910
 * @日期      : 2004/09/19
 */



import java.io.UnsupportedEncodingException;
import java.util.Vector;


public class workflow_tools {
  public workflow_tools() {
  }

  /**
   * 功能:  将汉字转换成unicode
   * @param str 需要转换的汉字
   * @return 转换后的unicode字符
   */
  public String chineseToUnicode(String str) {
    String newstring = null;
    try {
      if (str == null || str.equals("")) {
        return "";
      }
      newstring = new String(str.getBytes("GB2312"), "ISO-8859-1");
    }
    catch (UnsupportedEncodingException ex) {
      System.out.println(
          "<<<<<<<<<<< there is something wrong with the JavaBean method ! >>>>>>>>>>>>>>");
      ex.printStackTrace();
    }
    return newstring;
  }

  /**
   * 功能:  将unicode转换成汉字
   * @param str 需要转换的unicode字符
   * @return 转换后的汉字
   */
  public String unicodeToChinese(String str) {
    String newstring = null;
    try {
      if (str == null || str.equals("")) {
        return "";
      }
      newstring = new String(str.getBytes("ISO-8859-1"), "GB2312");
    }
    catch (UnsupportedEncodingException ex) {
      System.out.println(
          "<<<<<<<<<<< there is something wrong with the JavaBean method ! >>>>>>>>>>>>>>");
      ex.printStackTrace();
    }
    return newstring;
  }

  /**
   * 功能:判断字符串是否为只包括字母和数字
   * @param validString 需要判断处理的字符串
   * @return 如果只包含字母和数字则返回true,否则返回false
   */
  public boolean isChar(String validString) {
    byte[] tempbyte = validString.getBytes();
    for (int i = 0; i < validString.length(); i++) {
      if ( (tempbyte[i] < 48) || ( (tempbyte[i] > 57) & (tempbyte[i] < 65)) ||
          (tempbyte[i] > 122) || ( (tempbyte[i] > 90) & (tempbyte[i] < 97))) {
        return false;
      }
    }
    return true;
  }

  /**
   * 功能:把传入的double类型数据转换规定的包含几位小数的double类型数据
   * @param sourceNum 源数据
   * @param length 准备取小数点后几位数
   * @return 返回的数据
   */
  public double getSpecialPosition(double sourceNum, int length) {
    String tempStr = Double.toString(sourceNum);
    int tempLen = length;
    int dotPosition = tempStr.indexOf(".");
    int dot = dotPosition + 1 + tempLen;
    String resultStr = tempStr.substring(0, dot);
    double result = Double.valueOf(resultStr).doubleValue();
    return result;
  }

  /**
   * 功能:将输入的字符串按照某种要求的分隔符分隔开,形成一个不包含分隔符的数组
   * @param sourceStr 想要分隔的字符串
   * @param symbol 分隔符
   * @return 分隔好后不包含分隔符的字符串数组
   */
  public String[] split(String sourceStr, String symbol) {
    String[] returnStr;
    int index = 0;
    String tempStr = sourceStr;
    int subLength = symbol.length();
    Vector v = new Vector();
    while (true) {
      index = tempStr.indexOf(symbol);
      if (index == -1) {
        break;
      }
      v.add(tempStr.substring(0, index));
      tempStr = tempStr.substring(index + subLength);
    }
    if (tempStr.length() != 0) {
      v.add(tempStr);
    }
    if (v.size() > 0 && ( (String) v.get(0)).length() == 0) {
      v.remove(0);
    }
    returnStr = new String[v.size()];
    for (int i = 0; i < v.size(); i++) {
      returnStr[i] = (String) v.get(i);
    }
    return returnStr;
  }
}

⌨️ 快捷键说明

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