Press on the image to return to the main documentation page.
JStringFunctions
Written by Margret
List of types:
JStringFunctions
JStringFunctions
Events:
None
Members:
AddSpaces
(
HowMany
As
Int
)
As
String
AsciiCodes
As
String
At
(
YourString
As
String
,
SearchFor
As
String
)
As
Int
CurrentWeek
(
MyDate
As
String
)
As
Int
DayOfMonth
(
MyDate
As
String
)
As
Int
Decrypt
(
YourText
As
String
)
As
String
DialogResponse
As
String
Empty
(
StringText
As
String
)
As
Boolean
Encrypt
(
YourText
As
String
)
As
String
FileExist
(
PathAndFileName
As
String
)
As
Boolean
iif
(
Value1
As
String
,
Value2
As
String
,
Value3
As
String
)
As
String
Initialize
(
Parent
As
Form
)
As
String
InString
(
YourString
As
String
,
SearchFor
As
String
)
As
Long
IsEmpty
(
StringText
As
String
)
As
Boolean
IsInitialized
As
Boolean
Left
(
StringText
As
String
,
Length
As
Long
)
As
String
Len
(
StringText
As
String
)
As
Long
Lower
(
StringText
As
String
)
As
String
Ltrim
(
StringText
As
String
)
As
String
MB
(
Message
As
String
)
As
String
Mid
(
StringText
As
String
,
Start
As
Int
,
Length
As
Int
)
As
String
Month
(
MyDate
As
String
)
As
Int
MonthName
(
MyDate
As
String
)
As
String
MsgBox
(
mMessage
As
String
,
mTitle
As
String
)
As
String
MsgBox2
(
mMessage
As
String
,
mTitle
As
String
,
mPositive
As
String
,
mCancel
As
String
,
mNegative
As
String
,
mIcon
As
String
)
As
String
NewDate
(
DatePassed
As
String
,
HowManyDays
As
Int
)
As
String
NumOfDaysBetween
(
CurrentDate
As
String
,
OtherDate
As
String
)
As
Int
Proper
(
StringText
As
String
)
As
String
Right
(
StringText
As
String
,
Length
As
Long
)
As
String
RndChrGen
(
StringLength
As
Int
,
CharacterType
As
Int
)
As
String
Rtrim
(
StringText
As
String
)
As
String
SearchDate
(
Date1
As
String
,
Date2
As
String
,
DateRange
As
Int
)
As
Boolean
Split
(
CurrentString
As
String
,
Split_At_Delimiter
As
String
)
As
List
SplitGetWord
(
CurrentString
As
String
,
Split_At_Delimiter
As
String
,
GetElement
As
Int
)
As
String
Stuff
(
CurrentText
As
String
,
InsertInString
As
String
,
RemoveFromString
As
String
)
As
String
ToastMessageShow
(
mMessage
As
String
,
LongDuration
As
Boolean
)
As
String
Today
As
String
Trim
(
Text
As
String
)
As
String
Upper
(
StringText
As
String
)
As
String
Val
(
StringText
As
String
)
As
Double
ValidDate
(
ChkDate
As
String
)
As
Boolean
WeekDay
(
MyDate
As
String
)
As
String
WeekName
(
MyDate
As
String
)
As
String
Year
(
MyDate
As
String
)
As
String
Members description:
AddSpaces
(
HowMany
As
Int
)
As
String
Returns a string of spaces. The number returned is set by HowMany.
AsciiCodes
As
String
Returns a String with all the Characters and their ASCII codes.
At
(
YourString
As
String
,
SearchFor
As
String
)
As
Int
Returns the position of the SearchFor within YourString.
CurrentWeek
(
MyDate
As
String
)
As
Int
Returns the number of the current week, 1-52 from the date passed to MyDate.
DayOfMonth
(
MyDate
As
String
)
As
Int
Returns the day of the month like 1-31, from the date passed to MyDate.
Decrypt
(
YourText
As
String
)
As
String
Converts an encrypted string of text to readable format.
DialogResponse
As
String
Returns the last response from MsgBox2 selection. It differs from B4A in that the Text of the buttons will be
returned. If you set the buttons to: [Yes] [Cancel] [No], it will return: Yes, Cancel or No, just like the
text labels In the buttons.
Example:
Dim MyAnswer = MsgBox2("Delete File?", "WARNING", "Yes", "No", "", Null) As String
If you press the Yes button, MyAnswer will = "Yes"
If MyAnswer = "Yes" Then
'Delete File Here...
End If
Empty
(
StringText
As
String
)
As
Boolean
Test to see if the string is empty and returns True if it is, otherwise returns False.
Encrypt
(
YourText
As
String
)
As
String
Converts a string of text to simple encryption.
FileExist
(
PathAndFileName
As
String
)
As
Boolean
Returns True if the filename passed does exist, otherwise returns False.
Be sure to include the path like:
If FileExist("/mnt/sdcard/mydata.dat") Then MsgBox("Yes", "The Answer")
iif
(
Value1
As
String
,
Value2
As
String
,
Value3
As
String
)
As
String
This is a single line if conditional test. If Value1 is true, Value2 is returned, otherwise
Value3 will be returned. Works with strings and booleans.
Example:
MsgBox(iif("Bob"="Jim", "They are the same", "They are not the same"), "The Answer")
or
MyBoolean = iif(FirstTime = True, StartMyService = True, StartMyService = False)
Initialize
(
Parent
As
Form
)
As
String
Initializes the object for use. Pass the name of the Parent form, like: SF.Initialize(MainForm1).
InString
(
YourString
As
String
,
SearchFor
As
String
)
As
Long
Returns the position of the SearchFor within YourString.
IsEmpty
(
StringText
As
String
)
As
Boolean
Test to see if the string is empty and returns True if it is, otherwise returns False.
IsInitialized
As
Boolean
Tests whether the object has been initialized.
Left
(
StringText
As
String
,
Length
As
Long
)
As
String
Returns the Left portion of a string with the number of characters passed
in Length.
Len
(
StringText
As
String
)
As
Long
Returns the length of the string.
Lower
(
StringText
As
String
)
As
String
Returns the string converted to Lowercase characters.
Ltrim
(
StringText
As
String
)
As
String
Returns a new string with the leading spaces removed.
MB
(
Message
As
String
)
As
String
Same as MsgBox but only needs one parameter.
Mid
(
StringText
As
String
,
Start
As
Int
,
Length
As
Int
)
As
String
Returns the a new String for how ever many characters passed in Length from
a starting position passed in Start.
Example:
Mid(This is a long line of text, 5, 2)
In this example the function will Return: "is"
Month
(
MyDate
As
String
)
As
Int
Returns the number of the current month 1-12 as Int type, from the date passed to MyDate.
MonthName
(
MyDate
As
String
)
As
String
Returns the Name the current month as a String like January, etc., from the date passed to MyDate.
MsgBox
(
mMessage
As
String
,
mTitle
As
String
)
As
String
Same as MsgBox in B4A.
MsgBox2
(
mMessage
As
String
,
mTitle
As
String
,
mPositive
As
String
,
mCancel
As
String
,
mNegative
As
String
,
mIcon
As
String
)
As
String
Same as MsgBox2 in B4A.
NewDate
(
DatePassed
As
String
,
HowManyDays
As
Int
)
As
String
Returns a new date adding or subtracting HowManyDays. HowManyDays can be positive or
negitive numbers.
NumOfDaysBetween
(
CurrentDate
As
String
,
OtherDate
As
String
)
As
Int
Returns the numbers of days passed between the two dates passed.
Proper
(
StringText
As
String
)
As
String
Returns the string in proper format.
Example:
MyText = "jim joe brown"
MyText = SF.Proper(Mytext)
This function will return: "Jim Joe Brown"
Right
(
StringText
As
String
,
Length
As
Long
)
As
String
Returns the Right portion of a string with the number of characters passed
in Length.
RndChrGen
(
StringLength
As
Int
,
CharacterType
As
Int
)
As
String
Returns a string of ramdom characters with a length specified by StringLength. CharacterType tells
the function what type of characters to return.
CharacterType = 0 for Upper and Lower case
CharacterType = 1 for Upper case only
CharacterType = 2 for Lower case only
Rtrim
(
StringText
As
String
)
As
String
Returns a new string with the trailing spaces removed.
SearchDate
(
Date1
As
String
,
Date2
As
String
,
DateRange
As
Int
)
As
Boolean
Returns True if the Date1 and the Date2 are within x Days(DateRange) of each other.
Pass the dates as Strings.
Example:
SearchDate("03/01/2013", "02/15/2013", 30)
Split
(
CurrentString
As
String
,
Split_At_Delimiter
As
String
)
As
List
Returns a LIST of items from the string split at the Delimiter.
EXAMPLE:
Dim ANS As List
ANS = SF.Split("This is a test string.", " ")
SplitGetWord
(
CurrentString
As
String
,
Split_At_Delimiter
As
String
,
GetElement
As
Int
)
As
String
Returns just the one element selected with GetElement from the string.
EXAMPLE:
ANS = SF.SplitGetWord("This is a test string.", " ", 2)
In this example the function will Return: "test"
Stuff
(
CurrentText
As
String
,
InsertInString
As
String
,
RemoveFromString
As
String
)
As
String
Used to replace text in a string with new text.
Example:
MyText = "I will tell you that joe is a good friend!"
MyText = SF.Stuff(MyText, "Joe Brown", "joe")
This function will return: "I will tell you that Joe Brown is a good friend!"
ToastMessageShow
(
mMessage
As
String
,
LongDuration
As
Boolean
)
As
String
Shows a simple toast message, pass True for LongDuration for a longer display.
Today
As
String
Returns the devices date.
Trim
(
Text
As
String
)
As
String
Returns a new string will leading and trailing spaces removed.
Upper
(
StringText
As
String
)
As
String
Returns the string converted to Uppercase characters.
Val
(
StringText
As
String
)
As
Double
Returns the numerical value of a string. If the string contains now value it returns 0.
ValidDate
(
ChkDate
As
String
)
As
Boolean
Returns True if the date passed is a Valid date.
WeekDay
(
MyDate
As
String
)
As
String
Returns the number of the day of the week 1-7 as a String, from the date passed to MyDate.
WeekName
(
MyDate
As
String
)
As
String
Returns the name of the day of the week like Sunday, Monday, etc., from the date passed to MyDate.
Year
(
MyDate
As
String
)
As
String
Returns the year of the date passed in MyDate.
Example:
SF.Year("01/01/2013") returns "2013"
Top