# Strings

Auxiliary string processing functions

author | Lukas Korinek
package | Default

### Methods

## Checks if the haystack contains the needle

    contains(string $needle, string $haystack) : boolean

static

### Arguments

#### $needle

`string`

#### $haystack

`string`

### Response

`boolean`

## Checks if the haystack ends with the needle

    ends(string $needle, string $haystack) : boolean

static

### Arguments

#### $needle

`string`

#### $haystack

`string`

### Response

`boolean`

## Generates a hash which can be used for various token purposes

    generateHash(array $unique) : string

static

### Arguments

#### $unique

`array`

Unique combination array to make the hash unique

### Response

`string`

## Decides whether the string as a good candidate for a Git url e.g.

    isGitUrl(string $string, integer $type) : boolean

static

https://korinek111@bitbucket.org/mrrootcze/npsknowledge.git git@bitbucket.org:mrrootcze/npsknowledge.git

todo | Extend for different formats (https://stackoverflow.com/questions/2514859/regular-expression-for-git-repository)

### Arguments

#### $string

`string`

#### $type

`integer`

Type of the URL

### Response

`boolean`

True on valid string

## Decides if a string can be used as a password

    isStrongPassword(string $str) : boolean

static

### Arguments

#### $str

`string`

### Response

`boolean`

## Creates a random string of an arbitrary length

    random(integer $length = 15) : string

static

### Arguments

#### $length

`integer`

### Response

`string`

## Replaces all occurences of a needle in the haystack with the replacement Serves for future standardization (possible encoding issues)

    replace(string|array $needle, string $replacement, string $haystack) : string

static

### Arguments

#### $needle

`string|array`

#### $replacement

`string`

#### $haystack

`string`

### Response

`string`

## Sanitizes string to be consisting only from ASCII alphanumeric chars and hyphens

    sanitizeASCII(string $string) : string

static

### Arguments

#### $string

`string`

### Response

`string`

## Checks if the haystack starts with the needle

    starts(string $needle, string $haystack) : boolean

static

### Arguments

#### $needle

`string`

#### $haystack

`string`

### Response

`boolean`

## Adds parameters to an URL

    urlQuery(string $url, array $parameters) : string

static

### Arguments

#### $url

`string`

#### $parameters

`array`

### Response

`string`

### Constants

## GIT_ANY

    GIT_ANY

## GIT_SSH

    GIT_SSH

## GIT_HTTPS

    GIT_HTTPS