Package io.ciera.runtime.summit.util
Interface STRING
-
- All Known Implementing Classes:
STRINGImpl
public interface STRINGProvides implementations for standard string manipulation functions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intatoi(String s)Convert a string to an integer.Stringescapetics(String s)Replace all single quotes with two single quotes for escaping SQL insert statements.intindexof(String haystack, String needle)Gets the index of the first occurance ofneedleinhaystack.Stringitoa(int i)Convert an integer to a string.Stringquote()Return a literal double quote.intstrlen(String s)Get the length of a stringStringsubstr(String s, int begin, int end)Get a substring of an input string frombegin(inclusive) toend(exclusive).Stringtrim(String s)Trim whitespace from the start and end of a string.Stringunescapetics(String s)Replace all occurances of two adjacent single quotes with one single quote for unescaping SQL insert statements.
-
-
-
Method Detail
-
itoa
String itoa(int i)
Convert an integer to a string.- Parameters:
i- the integer to convert- Returns:
- the string representation of the input integer
-
atoi
int atoi(String s) throws XtumlException
Convert a string to an integer.- 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
String substr(String s, int begin, int end)
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 < 0or>the length ofs, the result is a substring starting atbeginto the end ofs. Ifend <= begin, the result is an empty string.- Parameters:
s- the input stringbegin- the start index of the substring (inclusive)end- the end index of the substring (exclusive)- Returns:
- the substring of
sfrombegin(inclusive) toend(exclusive)
-
strlen
int strlen(String s)
Get the length of a string- Parameters:
s- the input string- Returns:
- the length of the input string
-
indexof
int indexof(String haystack, String needle)
Gets the index of the first occurance ofneedleinhaystack. Returns -1 ifneedleis not contained inhaystack.- Parameters:
haystack- the string to searchneedle- the string pattern to search for- Returns:
- the index of the first occurance of
needleinhaystack
-
trim
String trim(String s)
Trim whitespace from the start and end of a string.- Parameters:
s- the input string- Returns:
- the input string with all leading and trailing whitespace removed.
-
quote
String quote()
Return a literal double quote.- Returns:
- a literal double quote
-
escapetics
String escapetics(String s)
Replace all single quotes with two single quotes for escaping SQL insert statements.- Parameters:
s- the input string- Returns:
- the input string with all single quotes replaced with two single quotes
-
-