|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object utils.StringTools
public class StringTools
Tools working on Strings (d'oh)
Copyright (c) 2006 Sebastian Erdweg Copyright (c) 2007 Dominik Schulz Copyright (c) 2006 Florian Lindner Copyright (c) 2006 Betim Berjani This file is part of FlexiCrypt. FlexiCrypt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. FlexiCrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FlexiCrypt; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Constructor Summary | |
---|---|
private |
StringTools()
This class provides only static methods. |
Method Summary | |
---|---|
static java.lang.String |
arrayToString(java.lang.Object[] arr)
|
static java.lang.String |
arrayToString(java.lang.Object[] arr,
java.lang.String delim)
|
static java.lang.String |
firstLetterUpperCaseOfEachWord(java.lang.String string)
Change the frist letter of each word in the string to upper case. |
static java.lang.String |
getFormatedStringOfBytes(byte[] b,
java.lang.String type)
Get a formated string of bytes. |
static java.lang.String |
getFormatedStringOfBytes(byte[] b,
java.lang.String type,
int maxLength)
Get a formated String of bytes with a given maximum length. |
static java.lang.String |
getStringOfByte(byte b)
|
static java.lang.String |
lineBreakAfterNchars(java.lang.String text,
int breakAfter)
|
static java.lang.String |
readFileIntoString(java.io.File file)
Read a file into a String |
static java.lang.String[] |
readFileIntoStringArray(java.lang.String filename)
Almost the same a readFileIntoString with the difference that the input is split a newlines and put into an array. |
static java.lang.String |
removeLineBreaks(java.lang.String text)
Remove every line-break from the string |
static java.lang.String |
removeLineBreaks(java.lang.String text,
int maxLength)
Remove every line-break from the string. |
static java.lang.String[] |
stringToArray(java.lang.String msg)
Convert a string to an string array. |
static java.lang.String[] |
stringToArray(java.lang.String msg,
java.lang.String delim)
Convert a string to an string array. |
static java.util.ArrayList<java.lang.String> |
stringToArrayList(java.lang.String msg)
Convert a string to an ArrayList |
static java.util.ArrayList<java.lang.String> |
stringToArrayList(java.lang.String msg,
java.lang.String delim)
Splits a String at the given delimiters and puts the result into an ArrayList |
static void |
writeStringIntoFile(java.lang.String text,
java.io.File file)
Write a string into a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private StringTools()
Method Detail |
---|
public static java.lang.String arrayToString(java.lang.Object[] arr)
arr
- the array to convert to a string line by line
public static java.lang.String arrayToString(java.lang.Object[] arr, java.lang.String delim)
arr
- the array to convert to a string line by linedelim
- the delimiter between the lines
public static java.lang.String firstLetterUpperCaseOfEachWord(java.lang.String string)
string
- the string to change
public static java.lang.String getFormatedStringOfBytes(byte[] b, java.lang.String type, int maxLength)
b
- type
- maxLength
-
public static java.lang.String getFormatedStringOfBytes(byte[] b, java.lang.String type)
b
- the byte arraytype
- box, dotted or other
public static java.lang.String getStringOfByte(byte b)
b
- a byte
public static java.lang.String lineBreakAfterNchars(java.lang.String text, int breakAfter)
text
- -
The String that will be broken up into lines of n charsbreakAfter
- -
The max. number of chars per line
public static java.lang.String readFileIntoString(java.io.File file) throws java.io.IOException
file
- the file to read from
java.io.IOException
public static java.lang.String[] readFileIntoStringArray(java.lang.String filename)
filename
-
public static java.lang.String[] stringToArray(java.lang.String msg)
msg
- string to split up
public static java.lang.String[] stringToArray(java.lang.String msg, java.lang.String delim)
msg
- string to split updelim
- the delimiter, e.g. "\n" or "\r\n" or maybe " ".
public static java.util.ArrayList<java.lang.String> stringToArrayList(java.lang.String msg)
msg
- string to split up
public static java.util.ArrayList<java.lang.String> stringToArrayList(java.lang.String msg, java.lang.String delim)
msg
- string to split updelim
- the delimiter, e.g. "\n" or "\r\n" or maybe " ".
public static void writeStringIntoFile(java.lang.String text, java.io.File file) throws java.io.IOException
text
- the string to write to the file.file
- the output file.
java.io.IOException
- if an I/O error ocurs.public static java.lang.String removeLineBreaks(java.lang.String text)
text
- w/ or w/o line breaks
public static java.lang.String removeLineBreaks(java.lang.String text, int maxLength)
text
- w/ or w/o line breaksmaxLength
- the maximum length of the returned string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |