Package | org.samchon.library.utils |
Class | public class StringUtil |
Inheritance | StringUtil ![]() |
Method | Defined By | ||
---|---|---|---|
addTab(str:String, size:int = 1):String [static]
Add tab(s) to the front of each line.
| StringUtil | ||
between(value:String, start:String = null, end:String = null):String [static]
Generate a substring. | StringUtil | ||
betweens(value:String, start:String = null, end:String = null):Array [static]
Generate substrings from A to B. | StringUtil | ||
ltrim(value:String, target:* = null):String [static]
Removes all designated characters from the beginning of the specified string.
| StringUtil | ||
removeHTMLSpaces(str:String):String [static]
| StringUtil | ||
replaceAll(value:String, org:*, repl:String):String [static]
| StringUtil | ||
rtrim(value:String, target:* = null):String [static]
Removes all designated characters from end of the specified string.
| StringUtil | ||
stod(value:String):Number [static]
| StringUtil | ||
stoi(value:String):int [static]
| StringUtil | ||
substitute(str:String, ... rest):String [static] | StringUtil | ||
trim(str:String, target:* = null):String [static]
Removes all designated characters from the beginning and end of the specified string
| StringUtil |
addTab | () | method |
public static function addTab(str:String, size:int = 1):String
Add tab(s) to the front of each line.
Parameters
str:String — The String wants to add tab(s)
| |
size:int (default = 1 ) — The size of tab
|
String — The String that is tabbed
|
between | () | method |
public static function between(value:String, start:String = null, end:String = null):String
Generate a substring.
Extracts a substring consisting of the characters from specified start to end It's same with str.substring( ? = (str.find(start) + start.size()), str.find(end, ?) )
ex) between("ABCD[EFGH]IJK", "[", "]") => "EFGH"
Parameters
value:String — Target string to be applied between
| |
start:String (default = null ) — A string for separating substring at the front
| |
end:String (default = null ) — A string for separating substring at the end
|
String — substring by specified terms
|
betweens | () | method |
public static function betweens(value:String, start:String = null, end:String = null):Array
Generate substrings from A to B.
Splits a string into an array of substrings dividing by specified delimeters of start and end. It's the array of substrings adjusted the between.
Parameters
value:String — Target string to split by between
| |
start:String (default = null ) — A string for separating substring at the front.
If omitted, it's same with split(end) not having last item.
| |
end:String (default = null ) — A string for separating substring at the end.
If omitted, it's same with split(start) not having first item.
|
Array — An array of substrings
|
ltrim | () | method |
public static function ltrim(value:String, target:* = null):String
Removes all designated characters from the beginning of the specified string.
Parameters
value:String — The String should be trimmed
| |
target:* (default = null ) — Designated character(s)
|
String — Updated String where designated characters was removed from the beginning
|
removeHTMLSpaces | () | method |
public static function removeHTMLSpaces(str:String):String
Parameters
str:String |
String |
replaceAll | () | method |
public static function replaceAll(value:String, org:*, repl:String):String
Parameters
value:String | |
org:* | |
repl:String |
String |
rtrim | () | method |
public static function rtrim(value:String, target:* = null):String
Removes all designated characters from end of the specified string.
Parameters
value:String — The String should be trimmed
| |
target:* (default = null ) — Designated character(s)
|
String — Updated String where designated characters was removed from the end
|
stod | () | method |
public static function stod(value:String):Number
Parameters
value:String |
Number |
stoi | () | method |
public static function stoi(value:String):int
Parameters
value:String |
int |
substitute | () | method |
public static function substitute(str:String, ... rest):String
Parameters
str:String | |
... rest |
String |
trim | () | method |
public static function trim(str:String, target:* = null):String
Removes all designated characters from the beginning and end of the specified string
Parameters
str:String — The String should be trimmed
| |
target:* (default = null ) — Designated character(s)
|
String — Updated String where designated characters was removed from the beginning and end
|