Various string operations. If you generate your page with generate-page-class you will
have access to this functions. Just use str.functionName and it will work.
See a demonstration in the demo-folder of this class.
|
stops to response
|
|
Converts an array to a string
byVal arr
:
seperator
(
string
)
: seperator between the array-fields
Return
(
string
) :
concated array
|
|
Encodes a string into ASCII Characters
This function takes a string (for example an email-address) and converts it to
standardized ASCII Character codes, thus blocking bots/spiders from reading your
email address, while yet allowing visitors to continue to read and use your proper
address via mailto links, etc. byVal str
:
Return
(
string
) :
the ASCII Encoded String
|
|
Makes every first letter of every word to upper-case.
Good for Names or cities. Example: "axel schweis" will result in "Axel Schweis" inputStr
:
Return
(
string
) :
changed string
|
|
an extension of the common replace() function. basically the same
but you can replace more parts in one go.
find (array) -> replaceWith (string): every match of 'find' will be replaced with the string
find (array[n]) -> replaceWith (array[n]): must be same size! every field will be replaced by the field
of replaceWith with the same index.
find (array[n]) -> replaceWith (array[m]): n > m! for the missing fields the last one will be taken
for replacement. e.g. find = array(1, 2), replaceWith = array(3) means that the 1 will be replaced with
3 and the 2 will also be replaced with 3 because there is no equivalent for the 2 byVal source
:
find
(
string array
)
: what you are looking for.
replaceWith
(
string array
)
: the value you want to replace the matches with.
Return
(
string
) :
the replaced source string
|
|
Concats a string "n" times
byVal str
:
n
(
int
)
: the number of concats
Return
(
string
) :
the concated string
|
|
defuses the HTML of given string. so html code wont be recognized as HTML code by browser
value
(
string
)
: the value which should be defused
Return
(
string
) :
defused value
|
|
divides a string into several string-paritions of a given length
string "HAXN" will result (partitionlength=2) in the following array:
a(0) = "HA"; a(1) = "XN" inputStr
(
string
)
: string which should be divided
byVal partitionLength
:
Return
(
array
) :
array with all partitions
|
|
Checks if the string ends with ...
byVal str
:
chars
(
string
)
: the compare char/string
Return
(
bool
) :
true if the two strings are equal
|
|
adds a slash "/" at the end of the string if there isnt one.
Good use for urls or paths if you want to be sure that there is a slash at the end
of an url or a path. pathString
(
string
)
: The string (url, path) you want to check
Return
(
string
) :
the new url. with a slash at the end.
|
|
takes a given string and makes it JSON valid (http://json.org/)
all characters which needs to be escaped are beeing replaced by their
unicode representation according to the
RFC4627#2.5 - http://www.ietf.org/rfc/rfc4627.txt?number=4627 val
(
string
)
: value which should be escaped
Return
(
string
) :
JSON valid string
|
|
checks if a given string can be found in a given array
all values in the array are treated as strings when comparing byVal aString
:
byVal anArray
:
caseSensitive
(
bool
)
: should the search be case sensitive?
Return
(
int
) :
index of the first found field within the array. -1 if not found
|
|
Replaces all {n} values in a given string through the n-index field of an array.
Its just like the string.format method in .NET. so if you provide "my Name is {0}" as
your input then the {0} will be replaced by the first field of your array. and so on. byVal str
:
arr
(
array
)
: the array with your values
Return
(
string
) :
changed string
|
|
generates a hidden input field and returns the HTML for it
name
(
string
)
: the name of the value
value
(
string
)
: the value it should hold
|
|
encodes a value so that any special chars will be transformed into html entities.
e.g. " will be "
value
(
string
)
: the value you want to encode
|
|
Checks if a char is an alphabetic character or not. A-Z or a-z
byVal character
:
Return
(
bool
) :
Wether the char is alphabetic or not.
|
|
checks if a given string is a syntactically valid email
value
:
Return
(
bool
) :
true if it is valid
|
Makes a string javascript persistent. Changes special characters, etc. byVal val
:
Return
(
string
) :
encoded string which can be used within javascript strings.
|
|
Converts a part of a multidimensional array to a string
byVal arr
:
seperator
(
string
)
: seperator between the array-fields
dimension
(
int
)
: the dimension index in the array -> e.g. you have an
array of the size (5, 2) -> with dimension 2 you get the array fields
(0, 2), (1, 2), ..., (4, 2) as the string object, savvy ?
Return
(
string
) :
concated array
|
|
provides "N/A" if the field beeing passed equals empty
txt
(
string
)
: the text
Return
(
string
) :
eighter "N/A" if the field txt is empty or the txt itself
|
|
returns null if the input is empty.
value
(
variant
)
: the value you are dealing with
Return
(
variant
) :
null if the value is empty, otherwise the value itself
|
|
right-aligns a given value by padding left a given character to a totalsize
example: input: 22 -> output: 00022 (padded to total length of 5 with the paddingchar 0) value
(
string
)
: the value which should be aligned right
totalLength
(
string
)
: whats the total Length of the result string
paddingChar
(
string
)
: the char which is taken for padding
Return
(
string
) :
right aligned string.
|
|
left-aligns a given value by padding right a given character to a totalsize
example: input: 22 -> output: 22000 (padded to total length of 5 with the paddingchar 0) value
(
string
)
: the value which should be aligned left
totalLength
(
string
)
: whats the total Length of the result string
paddingChar
(
string
)
: the char which is taken for padding
Return
(
string
) :
left aligned string.
|
|
shortens a string and adds a custom string at the end if string is longer than a given value.
byVal str
:
maxChars
(
string
)
: whats the maximum allowed length of chars
overflowString
(
int
)
: what string should be added at the end of the string if it has been cutted
Return
(
string
) :
cutted string
|
|
splits a string and returns a specified field of the array
it uses the split function but immediately returns you the field you want. stringToSplit
(
string
)
: the string you want to split
delimiter
(
string
)
: whats the delimiter for splitting
returnIndex
(
int
)
: what index should be returned after spliting?. -1 = get the last index
Return
(
string
) :
string content for the wanted field of the array
|
|
makes a given string safe for the use within sql statements
e.g. if its necessary to pass through an user input directly into a sql-query value
(
string
)
: the value which should be made "safe"
Return
(
string
) :
safe value. e.g. ' are escaped with '', etc.
|
|
Checks if the string begins with ...
byVal str
:
chars
(
string
)
: the compare char/string
Return
(
bool
) :
true if the two strings are equal
|
|
removes all Tags from a given string
Tags are defined as string-parts surrounded by a < and a >. example: <sample> inputStr
(
string
)
: string where the Tags should be removed
Return
(
string
) :
the input-String without any Tags
|
|
Swaps the Case of a String. Lower to Upper and vice a versa
str
(
string
)
: the source string
Return
(
string
) :
the swapped string
|
|
Converts a string to a "char" array
byVal str
:
Return
(
array
) :
a "char" array
|
|
takes a string and tries to convert it to a float. if converting not possible then an
alternative value will be taken
this method ALWAYS returns a float value! value
(
string
)
: value which should be converted to a float
alternative
(
float
)
: alternative value if converting is not possible
Return
(
float
) :
the value converted to a float or the alternative
|
|
takes a string and tries to convert it to an integer. if converting not possible then an
alternative value will be taken
this method ALWAYS returns an integer! value
(
string
)
: value which should be converted to an integer
alternative
(
int
)
: alternative value if converting is not possible
Return
(
int
) :
the value converted to an integer or the alternative
|
|
removes all non-printable chars from the end and the beginning of the string
spaces, returns, line-feeds, tabs, etc. will be removed inputStr
(
string
)
: string to be trimmed
Return
(
string
) :
trimmed string
|
|
Removes characters from the end of a string
byVal str
:
n
(
int
)
: the number of characters you want to remove
Return
(
string
) :
the trimmed string
|
|
Removes characters from the begin of a string
byVal str
:
n
(
int
)
: the number of characters you want to remove
Return
(
string
) :
the trimmed string
|
|
Removes characters from a given string with all occurencies of a matching string
byVal str
:
stringToTrim
(
string
)
: the "find" string which will be trimmed out of the string
Return
(
string
) :
the trimmed string
|
|
returns a full URL with a given file and given parameters
it encodes automatically the values of the parameters. path
(
string
)
: the path to the file. e.g. /file.asp, f.asp, http://domain.com/f.asp
params
(
string array
)
: the parameters for the url (querystring). if its an array
then every even field is the name and every odd field is the value. if its a string
then its treated as jusst one parameter value for the URL. e.g. file.asp?oneValue
anchor
:
Return
(
string
) :
an URL build with the parameters and fully URL-encoded. example: /file.asp?x=10
|
|
writes a string to the output in the same line
value
(
string
)
: output string
|
|
writes a value to the output.
Note: will only be executed on the development server
value
(
string
)
: the value to be written
|
|
writes a value to the output and stops the response.
The response will be stopped after writing the value. good for debuging. value
(
string
)
: the value you want to write
|
|
writes a line to the output
value
(
string
)
: output string
|