Package fr.formiko.usuel.types
Class str
java.lang.Object
fr.formiko.usuel.types.str
Types conversions from String
- Author:
- Hydrolien
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
addALaFinSiNecessaire(String s, String fin)
add fin at the end off s, if s does not arlerdy end by fin.static boolean
static boolean
is subS on the Stringstatic boolean
private static int
Count '.' & throw an exception if String is malformed.static void
erreurConversion(String xToY, String s)
special error for conversionstatic String
Delete forbidden char depending of the os.static String
filterForbiddenChar(String s, char[] t)
Delete forbidden char in the array t.static boolean
Return true if 1a char is an english maj char.static boolean
isVersionOver(String v1, String v2)
Return true if version1 > version2.static boolean
iToB(int b)
From int to booleanstatic byte
iToBy(int x)
From int to bytestatic String
iToS(int x)
From int to Stringstatic String[]
iToS(int[] ts)
From String to intstatic int
get the number of char x in a Stringstatic String[]
Split a string in an array.static boolean
From String to booleanstatic byte
From String to bytestatic byte
From String to bytestatic double
From String to doublestatic double
From String to doublestatic String
Transform a String to a directory name aviable on every os.static String
sToFileName(String s)
static int
From String to intstatic int[]
From int to Stringstatic int
From String to intstatic long
From String to longstatic long
sToLThrows(String s)
From String to intstatic String
Transform the first char of a String to the toUpperCase char.static String
Transform the first char of a String to the toLowerCase char.static String
str(char c)
static String
str(double x)
static String
str(float x)
static String
str(int s)
static String
static String
stripAccents(String s)
Remove all accent & replace special char by latin one.static String
Transform the first char of a String to the toUpperCase char.
-
Constructor Details
-
str
public str()
-
-
Method Details
-
split
Split a string in an array.- Parameters:
toSplit
- String to splitsplitChar
- Array of char used to splitstrLimiterChar
- char that define the start or the end of a unsecable string
-
stripAccents
Remove all accent & replace special char by latin one. -
countPointAndThrowExecption
Count '.' & throw an exception if String is malformed.
String is concider malformed if it have other char than "1234567890.". -
isVersionOver
Return true if version1 > version2. -
nbrDeX
get the number of char x in a String- Parameters:
s
- String were to search.x
- char to search on s.- Returns:
- number of char x in s.
-
contient
is subS on the String- Parameters:
s
- String were to search.subS
- String to search on s.x
- 0=s should starts with subS, 1=s should contain subS, 2=s should end with subsS, 3=s should be equals to subS.- Returns:
- true if it contain subS
-
contient
-
contient
-
addALaFinSiNecessaire
add fin at the end off s, if s does not arlerdy end by fin.- Parameters:
s
- main String.fin
- String to add on s.- Returns:
- s with fin at the end.
-
filterForbiddenChar
Delete forbidden char in the array t.- Parameters:
s
- the String were to delete forbidden char.t
- the array were forbidden char are.
-
filterForbiddenChar
Delete forbidden char depending of the os.
if os is not define windows char will be deleted.- Parameters:
s
- the String were to delete forbidden char.
-
sToFileName
-
sToDirectoryName
Transform a String to a directory name aviable on every os.
If last / is missing it will be add. If there is a 1a / it will be delete. If there is \ they will be transform by /.- Parameters:
s
- the String to transform to a directory name.
-
sToSMaj
Transform the first char of a String to the toUpperCase char.
if s is "" or null nothing will be done.- Parameters:
s
- the String to transform.
-
toMaj
Transform the first char of a String to the toUpperCase char.
if s is "" or null nothing will be done.- Parameters:
s
- the String to transform.
-
sToSMin
Transform the first char of a String to the toLowerCase char.
if s is "" or null nothing will be done.- Parameters:
s
- the String to transform.
-
isMaj
Return true if 1a char is an english maj char.
only A to Z without accent char are ok.- Parameters:
s
- the String to test.
-
sToI
From String to int return -1 if conversion fail. -
sToI
From String to int return Default value if conversion fail. -
sToD
From String to double return -1 if conversion fail. -
sToD
From String to double return Default value if conversion fail. -
sToLThrows
From String to int Throw a Exception trows if conversion fail.- Throws:
Exception
-
sToL
From String to long return -1 if conversion fail. -
iToS
From int to String -
iToBy
public static byte iToBy(int x)From int to byte return the max or the min if conversion fail. -
iToB
public static boolean iToB(int b)From int to boolean return true if conversion fail. -
sToB
From String to boolean boolean can be "true", "false" or "1", "0". -
sToBy
From String to byte -
sToBy
From String to byte -
erreurConversion
special error for conversion return -1 if conversion fail. -
sToI
From int to String -
iToS
From String to int file a case with -1 if conversion fail. -
str
-
str
-
str
-
str
-
str
-