Press on the image to return to the main documentation page.
StringUtils
List of types:
StringUtils
StringUtils
Collection of strings related functions.
The
Table example
uses LoadCSV to show the data in a table.
Events:
None
Members:
DecodeBase64
(
Data
As
String
)
As
Byte
()
DecodeUrl
(
Url
As
String
,
CharSet
As
String
)
As
String
EncodeBase64
(
Data
()
As
Byte
)
As
String
EncodeUrl
(
Url
As
String
,
CharSet
As
String
)
As
String
LoadCSV
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
)
As
List
LoadCSV2
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
,
Headers
As
List
)
As
List
MeasureMultilineTextHeight
(
TextView
As
android
.
widget
.
TextView
,
Text
As
CharSequence
)
As
Int
SaveCSV
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
,
Table
As
List
)
SaveCSV2
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
,
Table
As
List
,
Headers
As
List
)
Members description:
DecodeBase64
(
Data
As
String
)
As
Byte
()
Decodes data from Base64 notation.
DecodeUrl
(
Url
As
String
,
CharSet
As
String
)
As
String
Decodes an application/x-www-form-urlencoded string.
EncodeBase64
(
Data
()
As
Byte
)
As
String
Encodes the given bytes array into Base64 notation.
Example:
Dim
su
As
StringUtils
Dim
encoded
As
String
encoded
=
su
.
EncodeBase64
(
data
)
'data is a bytes array
EncodeUrl
(
Url
As
String
,
CharSet
As
String
)
As
String
Encodes a string into application/x-www-form-urlencoded format.
Url - String to encode.
CharSet - The character encoding name.
Example:
Dim
su
As
StringUtils
Dim
url
,
encodedUrl
As
String
encodedUrl
=
su
.
EncodeUrl
(
url
,
"UTF8"
)
LoadCSV
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
)
As
List
Loads a CSV file and stores it in a list of string arrays.
Dir - CSV file folder.
FileName - CSV file name.
SeparatorChar - The character used to separate fields.
Example:
Dim
su
As
StringUtils
Dim
Table
As
List
Table
=
su
.
LoadCSV
(
File
.
DirAssets
,
"1.csv"
,
","
)
LoadCSV2
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
,
Headers
As
List
)
As
List
Similar to LoadCSV. Will load the first row to the headers list.
MeasureMultilineTextHeight
(
TextView
As
android
.
widget
.
TextView
,
Text
As
CharSequence
)
As
Int
Returns the required height in order to show the given text in a label.
This can be used to show dynamic text in a label.
Note that the label must first be added to its parent and only then its height can be set.
Example:
Dim
Label1
As
Label
Label1
.
Initialize
(
""
)
Label1
.
Text
=
"this is a long sentence, and we need to "
_
&
"know the height required in order To show it completely."
Label1
.
TextSize
=
20
Activity
.
AddView
(
Label1
,
10dip
,
10dip
,
200dip
,
30dip
)
Dim
su
As
StringUtils
Label1
.
Height
=
su
.
MeasureMultilineTextHeight
(
Label1
,
Label1
.
Text
)
SaveCSV
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
,
Table
As
List
)
Saves the table as a CSV file.
Dir - Output file folder.
FileName - Output file name.
SeparatorChar - Separator character. The character that separates fields.
Table - A List with arrays of strings as items. Each array represents a row. All arrays should be of the same length.
Example:
Dim
su
As
StringUtils
su
.
SaveCSV
(
File
.
DirRootExternal
,
"1.csv"
,
","
,
table
)
SaveCSV2
(
Dir
As
String
,
FileName
As
String
,
SeparatorChar
As
Char
,
Table
As
List
,
Headers
As
List
)
Similar to SaveCSV. Will save the headers list as the first row. This should be a list (or array) of strings.
Top