NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package jp.co.vinculumjapan.mdware.common.util;

import java.math.BigDecimal;
import java.util.Calendar;

/**
* <p>�^�C�g��:���������[�e�B���e�B�N���X</p>
* <p>����: </p>
* <p>������: Copyright (c) 2007</p>
* <p>������: Vinculum Japan Corp.</p>
* @author
* @version 1.0
*/
public class StringUtility {

/** ���W�����X11 */
private static final int M11 = 11;
/** ���W�����X11�`�F�b�N�K�p�E�G�C�g�l */
private static final int[] W11 = {3, 2, 7, 6, 5, 4, 3, 2};

/**
* �����_�������������B
* @param str ����������������
* @return ����������������
*/
public static String roundDown(String str) {
try {
return Long.toString(Math.round(Double.parseDouble(str)));
} catch (Exception e) {
return null;
}
}

/**
* ���������w���o�C�g�����J�b�g�������B
* @param str
* @param startByte
* @param byteCnt
* @return
*/
public synchronized static String cutString(String str, int startByte, int byteCnt) {
if (str == null) {
return "";
}
byte[] strBytes = str.getBytes();
String wkStr = "";
try {
byte[] chByte = new byte[byteCnt];
int cnt = 0;
for (int i = startByte; i < strBytes.length; i++) {
chByte[cnt] = strBytes[i];
if (cnt > byteCnt) {
break;
}
cnt++;
}
byte[] chByteRet = new byte[cnt];
for (int i = 0; i < cnt; i++) {
chByteRet[i] = chByte[i];
}
wkStr += new String(chByteRet, "Shift_JIS");
} catch (Exception e) {
}
//��������������������������
// wkStr += spaceFormat("", byteCnt - wkStr.getBytes().length);
return wkStr;
}

/**
* �w��Byte�����������X�y�[�X���t�������B
* @param data
* @param n
* @return
*/
public static String spaceFormat(String data, int n) {
int i1, len;
data = data == null ? "" : data;
len = data.length();
if (len != n) {
// �������Z��
if (len < n) {
for (i1 = 0; i1 < n - len; i1++)
data = data + " ";
}
}
return data;
}

/**
* �p�����[�^��NULL����������������������
* @param String
* @return String
*/
public static String cnvNullToBlank(String s) {
if (s == null) {
return "";
} else {
return s;
}
}

/**
* �p�����[�^���J���
if (s == null) {
return "";
} else {
return s.replaceAll(",", " ");
}
}

/**
* �w������0�������s�����<br>
* �w�������
result = result.concat("0");
}
}
result = result.concat(oldStr);

return result;
}

/**
* ���������u�����s�����<br>
* @param input ������������������
* @param pattern �u���O��������
* @param replacement �u������������
* @return �u����������������
*/
public static String substitute(String input, String pattern, String replacement) {

if (input == null || input.trim().length() == 0) {
// ----- �����������^�[��
return "";
} else if ((pattern == null || pattern.trim().length() == 0) ||
(replacement == null || replacement.trim().length() == 0)) {
// ----- �u�������������������^�[��
return input;
} else {
// ----- �u�������������^�[��
if (input.indexOf(pattern) != -1) {

int pos = input.length();
StringBuffer sb = new StringBuffer(input);

while ((pos = input.lastIndexOf(pattern, pos - 1)) != -1) {
sb.delete(pos, pos + pattern.length());
sb.insert(pos, replacement);
}

input = sb.toString();
}

return input;
}
}

/**
* ���������u�����s�����<br>
* @param input ������������������
* @param pattern �u���O���������z��
* @param replacement �u�������������z��
* @return �u����������������
*/
public static String substitute(String input, String[] pattern, String[] replacement) {

if (input == null || input.trim().length() == 0) {
// ----- �����������^�[��
return "";
} else if (pattern == null || replacement == null) {
// ----- �u�������������������^�[��
return input;
} else {
// ----- �u�������������^�[��
// �u�����������A�������u�����������

/**
* �`�F�b�N�f�W�b�g�������s�����<br>
* <pre>
* 1. 1�`8�����e�s�l�������E�G�C�g�l�������������A���a(�@)���v�Z�����B
* 2. �@�����W�����X11�������A�]��(�A)���v�Z�����B
* 3. �A���l��0�A��������1������
* �� �`�F�b�N�f�W�b�g��0�����p�����B
* ���L���O������
* �� ���W�����X11�����]�����������l���A�`�F�b�N�f�W�b�g���������p�����B
*
* �� �����w�����l���A8�������l�������������������A�`�F�b�N�f�W�b�g[0]���������p�����B
* </pre>
* @param code 8�������l������
* @return �`�F�b�N�f�W�b�g�����������p<br>
* �`�F�b�N�f�W�b�g�v�Z�����
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.