Categories
Coding

XtScript Function: addslashes

XtScript addslashes function will process a string and add a backslashes (\) before each single quotes (‘), double quotes (“), backslashes (\), found on the string and NULL variable. The most practical example of the XtScript addslashes function is when we are using a string in a Javascript code where single quote and double quote […]

Categories
Coding

XtScript Function: strstr and stristr

strstr is an XtScript function to return a part of string started from the certain first occurrence of the case-sensitive substring passed in the needle argument found. If you want the function to treat the substring passed in the needle argument as case-insensitive, you can use XtScript stristr function instead. XtScript strstr and stristr function […]

Categories
Coding

XtScript Function: ucwords

XtScript ucwords is a function that can replace the first character of each words in a string to uppercase and return the result. <!–parser:xtscript–> call ucwords $val=… <!–/parser:xtscript–> Learn XtScript ucwords function from examples Change all the first character in each words to uppercase. <!–parser:xtscript–> var $string = Do you want to learn XtScript together? […]

Categories
Coding

XtScript Function: substr

substr is an XtScript function that can trim / cut a string from a specific character index position, for certain length, and return the result. XtScript substr function basic syntax: <!–parser:xtscript–> call substr $val=…; $start=…; $length=… <!–/parser:xtscript–> Available arguments in XtScript substr function: List of arguments in XtScript substr function Arguments Value Mandatory Explanation $val […]

Categories
Coding

XtScript Function: urlencode and urldecode

urlencode is an XtScript function that will process a string and encode all special characters (mainly non-alphanumeric) and return the result. space will be encoded to +. For space encoded as %20, see XtScript rawurlencode function. After encoded, the string then can be safe to send over the url, example for use in GET or […]

Categories
Coding

XtScript Function: strrpos and strripos

XtScript strrpos and strripos is XtScript function that will search and return the position of the last occurrence of a matched substring. The difference between strrpos and strripos is that strrpos will search the substring as CASE-SENSITIVE, while strripos as CASE-INSENSITIVE. If you want the function to search and return the position of the first […]

Categories
Coding

XtScript Function: strpos and stripos

If you want to perform a search-alike operation, there are two XtScript built-in functions may can achieve it by finding the position of a substring from a string which are strpos and `stripos“““““`. Both strpos and stripos will perform a search of a substring and return the first occurrence of the substring position. The difference […]

Categories
Coding

XtScript Function: rawurlencode and rawurldecode

If we need to send information via the url using GET or POST method, it is recommended to encode it first to make sure it will not harm our site or other visitors. XtScript has predefined functions that can handle url encoding/decoding, those are rawurlencode and rawurldecode. XtScript rawurlencode is a function that will process […]

Categories
Coding

XtScript Function: str_pad

pad is an XtScript function that can padding additional string to the main string. XtScript pad function basic syntax: <!–parser:xtscript–> call str_pad $val=…; $pad_length=…; $pad_string=…; $pad_type=… <!–/parser:xtscript–> Available arguments in XtScript pad function: Argument Mandatory Value Explanation $pad_length Required Number Specified the maximum length of the resulted string after pad. If the value is smaller […]

Categories
Coding

XtScript Function: strip_tags

XtScript strip_tags is a helpful and handy function if you want to easily remove all HTML tags in a string. A few practical usage removing HMTL tags before sending it to the browser for example in comment box to remove all unwanted HTML tags, or when assigning text to a meta content. XtScript strip_tags function […]