strings

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Concat

func Concat(_ context.Context, args ...core.Value) (core.Value, error)

Concat concatenates one or more instances of Read, or an Array. @params src (String...|Array) - The source string / array. @returns String

func ConcatWithSeparator

func ConcatWithSeparator(_ context.Context, args ...core.Value) (core.Value, error)

ConcatWithSeparator concatenates one or more instances of Read, or an Array with a given separator. @params separator (string) - The separator string. @params src (string...|array) - The source string / array. @returns string

func Contains

func Contains(_ context.Context, args ...core.Value) (core.Value, error)

Contains returns a value indicating whether a specified substring occurs within a string. @param src (String) - The source string. @param search (String) - The string to seek. @param returnIndex (Boolean) - Values which indicates whether to return the character position of the match is returned instead of a boolean. The default is false. @returns (Boolean|Int)

func EncodeURIComponent

func EncodeURIComponent(_ context.Context, args ...core.Value) (core.Value, error)

EncodeURIComponent returns the encoded String of uri. @param (String) - Uri to encode. @returns String - Encoded string.

func FindFirst

func FindFirst(_ context.Context, args ...core.Value) (core.Value, error)

FindFirst returns the position of the first occurrence of the string search inside the string text. Positions start at 0. @param src (String) - The source string. @param search (String) - The string to seek. @param start (Int, optional) - Limit the search to a subset of the text, beginning at start. @param end (Int, optional) - Limit the search to a subset of the text, ending at end @returns (Int) - The character position of the match. If search is not contained in text, -1 is returned. If search is empty, start is returned.

func FindLast

func FindLast(_ context.Context, args ...core.Value) (core.Value, error)

FindLast returns the position of the last occurrence of the string search inside the string text. Positions start at 0. @param src (String) - The source string. @param search (String) - The string to seek. @param start (Int, optional) - Limit the search to a subset of the text, beginning at start. @param end (Int, optional) - Limit the search to a subset of the text, ending at end @returns (Int) - The character position of the match. If search is not contained in text, -1 is returned. If search is empty, start is returned.

func FromBase64 added in v0.3.0

func FromBase64(_ context.Context, args ...core.Value) (core.Value, error)

* Returns the value of a base64 representation. * @param base64String (String) - The string to decode. * @returns value (String) - The decoded string.

func JSONParse

func JSONParse(_ context.Context, args ...core.Value) (core.Value, error)

JSONParse returns a FQL value described by the JSON-encoded input string. @params text (String) - The string to parse as JSON. @returns FQL value (Read)

func JSONStringify

func JSONStringify(_ context.Context, args ...core.Value) (core.Value, error)

JSONStringify returns a JSON string representation of the input value. @params value (Read) - The input value to serialize. @returns json (String)

func LTrim

func LTrim(_ context.Context, args ...core.Value) (core.Value, error)

LTrim returns the string value with whitespace stripped from the start only. @param value (String) - The string. @param chars (String) - Overrides the characters that should be removed from the string. It defaults to \r\n \t. @returns (String) - The string without chars at the left-hand side.

func Left

func Left(_ context.Context, args ...core.Value) (core.Value, error)

Left returns the leftmost characters of the string value by index. @param src (String) - The source string. @params length (Int) - The amount of characters to return. @returns substr (String)

func Like

func Like(_ context.Context, args ...core.Value) (core.Value, error)

Like checks whether the pattern search is contained in the string text, using wildcard matching. @param text (String) - The string to search in. @param search (String) - A search pattern that can contain the wildcard characters. @param caseInsensitive (Boolean) - If set to true, the matching will be case-insensitive. The default is false. @return (Boolean) - Returns true if the pattern is contained in text, and false otherwise.

func Lower

func Lower(_ context.Context, args ...core.Value) (core.Value, error)

Lower converts strings to their lower-case counterparts. All other characters are returned unchanged. @param src (String) - The source string. @returns (String) - THis string in lower case.

func Md5

func Md5(_ context.Context, args ...core.Value) (core.Value, error)

Md5 calculates the MD5 checksum for text and return it in a hexadecimal string representation. @param text (String) - The string to do calculations against to. @return (String) - MD5 checksum as hex string.

func NewLib

func NewLib() map[string]core.Function

func RTrim

func RTrim(_ context.Context, args ...core.Value) (core.Value, error)

RTrim returns the string value with whitespace stripped from the end only. @param value (String) - The string. @param chars (String) - Overrides the characters that should be removed from the string. It defaults to \r\n \t. @returns (String) - The string without chars at the right-hand side.

func RandomToken

func RandomToken(_ context.Context, args ...core.Value) (core.Value, error)

RandomToken generates a pseudo-random token string with the specified length. The algorithm for token generation should be treated as opaque. @param length (Int) - The desired string length for the token. It must be greater than 0 and at most 65536. @return (String) - A generated token consisting of lowercase letters, uppercase letters and numbers.

func RegexMatch

func RegexMatch(_ context.Context, args ...core.Value) (core.Value, error)

RegexMatch returns the matches in the given string text, using the regex. @param text (String) - The string to search in. @param regex (String) - A regular expression to use for matching the text. @param caseInsensitive (Boolean) - If set to true, the matching will be case-insensitive. The default is false. @return (Array) - An array of strings containing the matches.

func RegexReplace

func RegexReplace(_ context.Context, args ...core.Value) (core.Value, error)

RegexReplace replace every substring matched with the regexp with a given string. @param text (String) - The string to split. @param regex (String) - A regular expression search pattern. @param replacement (String) - The string to replace the search pattern with @param caseInsensitive (Boolean) - If set to true, the matching will be case-insensitive. The default is false. @return (String) - Returns the string text with the search regex pattern replaced with the replacement string wherever the pattern exists in text

func RegexSplit

func RegexSplit(_ context.Context, args ...core.Value) (core.Value, error)

RegexSplit splits the given string text into a list of strings, using the separator. @param text (String) - The string to split. @param regex (String) - A regular expression to use for splitting the text. @param caseInsensitive (Boolean) - If set to true, the matching will be case-insensitive. The default is false. @param limit (Int) - Limit the number of split values in the result. If no limit is given, the number of splits returned is not bounded. @return (Array) - An array of strings splited by teh expression.

func RegexTest

func RegexTest(_ context.Context, args ...core.Value) (core.Value, error)

RegexTest test wether the regexp has at least one match in the given text. @param text (String) - The string to split. @param regex (String) - A regular expression to use for splitting the text. @param caseInsensitive (Boolean) - If set to true, the matching will be case-insensitive. The default is false. @return (Boolean) - Returns true if the pattern is contained in text, and false otherwise.

func Reverse

func Reverse(_ context.Context, args ...core.Value) (core.Value, error)

Reverse returns the reverse of the string value. @param text (String) - The string to revers @returns (String) - Returns a reversed version of the string.

func Right(_ context.Context, args ...core.Value) (core.Value, error)

Right returns the rightmost characters of the string value. @param src (String) - The source string. @params length (Int) - The amount of characters to return. @returns substr (String)

func Sha1

func Sha1(_ context.Context, args ...core.Value) (core.Value, error)

Sha1 calculates the SHA1 checksum for text and returns it in a hexadecimal string representation. @param text (String) - The string to do calculations against to. @return (String) - Sha1 checksum as hex string.

func Sha512

func Sha512(_ context.Context, args ...core.Value) (core.Value, error)

Sha512 calculates the SHA512 checksum for text and returns it in a hexadecimal string representation. @param text (String) - The string to do calculations against to. @return (String) - SHA512 checksum as hex string.

func Split

func Split(_ context.Context, args ...core.Value) (core.Value, error)

Split splits the given string value into a list of strings, using the separator. @params text (String) - The string to split. @params separator (String) - The sperator. @params limit (Int) - Limit the number of split values in the result. If no limit is given, the number of splits returned is not bounded. @returns strings (Array<String>) - Array of strings.

func Substitute

func Substitute(_ context.Context, args ...core.Value) (core.Value, error)

Substitute replaces search values in the string value. @params text (String) - The string to modify @params search (String) - The string representing a search pattern @params replace (String) - The string representing a replace value @param limit (Int) - The cap the number of replacements to this value. @return (String) - Returns a string with replace substring.

func Substring

func Substring(_ context.Context, args ...core.Value) (core.Value, error)

Substring returns a substring of value. @params value (String) - The source string. @param offset (Int) - Start at offset, offsets start at position 0. @param length (Int, optional) - At most length characters, omit to get the substring from offset to the end of the string. Optional. @returns substring (String) - A substring of value.

func ToBase64

func ToBase64(_ context.Context, args ...core.Value) (core.Value, error)

ToBase64 returns the base64 representation of value. @param value (string) - The string to encode. @returns toBase64String (String) - A base64 representation of the string.

func Trim

func Trim(_ context.Context, args ...core.Value) (core.Value, error)

Trim returns the string value with whitespace stripped from the start and/or end. @param value (String) - The string. @param chars (String) - Overrides the characters that should be removed from the string. It defaults to \r\n \t. @returns (String) - The string without chars on both sides.

func Upper

func Upper(_ context.Context, args ...core.Value) (core.Value, error)

Upper converts strings to their upper-case counterparts. All other characters are returned unchanged. @param src (String) - The source string. @returns (String) - THis string in upper case.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL