Class STRINGImpl<C extends IComponent<C>>
- java.lang.Object
-
- io.ciera.runtime.summit.util.Utility<C>
-
- io.ciera.runtime.summit.util.impl.STRINGImpl<C>
-
- All Implemented Interfaces:
IActionHome<C>
,STRING
public class STRINGImpl<C extends IComponent<C>> extends Utility<C> implements STRING
-
-
Constructor Summary
Constructors Constructor Description STRINGImpl(C context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
atoi(String s)
Convert a string to an integer.String
escapetics(String s)
Replace all single quotes with two single quotes for escaping SQL insert statements.int
indexof(String haystack, String needle)
Gets the index of the first occurance ofneedle
inhaystack
.String
itoa(int i)
Convert an integer to a string.String
quote()
Return a literal double quote.int
strlen(String s)
Get the length of a stringString
substr(String s, int begin, int end)
Get a substring of an input string frombegin
(inclusive) toend
(exclusive).String
trim(String s)
Trim whitespace from the start and end of a string.String
unescapetics(String s)
Replace all occurances of two adjacent single quotes with one single quote for unescaping SQL insert statements.-
Methods inherited from class io.ciera.runtime.summit.util.Utility
context, getRunContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.ciera.runtime.summit.application.IActionHome
warn
-
-
-
-
Constructor Detail
-
STRINGImpl
public STRINGImpl(C context)
-
-
Method Detail
-
itoa
public String itoa(int i)
Description copied from interface:STRING
Convert an integer to a string.
-
atoi
public int atoi(String s) throws XtumlException
Description copied from interface:STRING
Convert a string to an integer.- Specified by:
atoi
in interfaceSTRING
- Parameters:
s
- the string to parse- Returns:
- the integer representation of the input string
- Throws:
XtumlException
- if the string cannot be parsed to an integer.
-
substr
public String substr(String s, int begin, int end)
Description copied from interface:STRING
Get a substring of an input string frombegin
(inclusive) toend
(exclusive). Ifbegin < 0
, the result is a substring starting at the beginning ofs
. Ifbegin >
the length ofs - 1
, the result is an empty string. Ifend < 0
or>
the length ofs
, the result is a substring starting atbegin
to the end ofs
. Ifend <= begin
, the result is an empty string.
-
strlen
public int strlen(String s)
Description copied from interface:STRING
Get the length of a string
-
indexof
public int indexof(String haystack, String needle)
Description copied from interface:STRING
Gets the index of the first occurance ofneedle
inhaystack
. Returns -1 ifneedle
is not contained inhaystack
.
-
trim
public String trim(String s)
Description copied from interface:STRING
Trim whitespace from the start and end of a string.
-
quote
public String quote()
Description copied from interface:STRING
Return a literal double quote.
-
escapetics
public String escapetics(String s)
Description copied from interface:STRING
Replace all single quotes with two single quotes for escaping SQL insert statements.- Specified by:
escapetics
in interfaceSTRING
- Parameters:
s
- the input string- Returns:
- the input string with all single quotes replaced with two single quotes
-
unescapetics
public String unescapetics(String s)
Description copied from interface:STRING
Replace all occurances of two adjacent single quotes with one single quote for unescaping SQL insert statements.- Specified by:
unescapetics
in interfaceSTRING
- Parameters:
s
- the input string- Returns:
- the input string with all occurances of two adjacent single quotes replaced with one single quote
-
-