Functions that manipulate strings

Although these functions are exported, they are subject to change without notice.

## Index

### Variables

- hostRegex
- splitEqual
- splitHash
- splitQuery
- stringifyPatternFn

### Functions

- _fromJson
- _toJson
- beforeAfterSubstr
- fnToString
- functionToString
- joinNeighborsR
- kebobString
- maxLength
- padString
- promiseToString
- splitOnDelim
- stringify
- stringifyPattern
- stripLastPathElement
- trimHashVal

## Variables

hostRegex: RegExp = new RegExp('^(?:[a-z]+:)?//[^/]+/')

- Defined in common/strings.ts:121

splitEqual: (Anonymous function) = beforeAfterSubstr('=')

- Defined in common/strings.ts:125

splitHash: (Anonymous function) = beforeAfterSubstr('#')

- Defined in common/strings.ts:123

splitQuery: (Anonymous function) = beforeAfterSubstr('?')

- Defined in common/strings.ts:124

stringifyPatternFn: function = null

#### Type declaration

- - (val: any): string

  - #### Parameters

    - ##### val any

    #### Returns string

- Defined in common/strings.ts:80

## Functions

- _fromJson(json: string): any

- #### Parameters

  - ##### json string

  #### Returns any

  - Defined in common/strings.ts:54

- _toJson(obj: Obj): string

- #### Parameters

  - ##### obj Obj

  #### Returns string

  - Defined in common/strings.ts:50

- beforeAfterSubstr(char: string): (Anonymous function)

- Returns a function that splits a string on a character or substring

- Returns a function that splits a string on a character or substring

  #### Parameters

  - ##### char string

  #### Returns (Anonymous function)

  - Defined in common/strings.ts:114

- fnToString(fn: IInjectable): any

- #### Parameters

  - ##### fn IInjectable

  #### Returns any

  - Defined in common/strings.ts:75

- functionToString(fn: Function): any

- #### Parameters

  - ##### fn Function

  #### Returns any

  - Defined in common/strings.ts:63

- joinNeighborsR(acc: any[], x: any): any[]

- Reduce fn that joins neighboring strings

- Reduce fn that joins neighboring strings

  Given an array of strings, returns a new array where all neighboring strings have been joined.

  #### Example:

      let arr = ["foo", "bar", 1, "baz", "", "qux" ];
      arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]

  #### Parameters

  - ##### acc any[]

  - ##### x any

  #### Returns any[]

  - Defined in common/strings.ts:157

- kebobString(camelCase: string): string

- #### Parameters

  - ##### camelCase string

  #### Returns string

  - Defined in common/strings.ts:44

- maxLength(max: number, str: string): string

- Returns a string shortened to a maximum length

- Returns a string shortened to a maximum length

  If the string is already less than the `max` length, return the string. Else return the string, shortened to `max - 3` and append three dots ("...").

  #### Parameters

  - ##### max number

    :

    the maximum length of the string to return

  - ##### str string

    :

    the input string

  #### Returns string

  - Defined in common/strings.ts:25

- padString(length: number, str: string): string

- Returns a string, with spaces added to the end, up to a desired str length

- Returns a string, with spaces added to the end, up to a desired str length

  If the string is already longer than the desired length, return the string. Else returns the string, with extra spaces on the end, such that it reaches `length` characters.

  #### Parameters

  - ##### length number

    :

    the desired length of the string to return

  - ##### str string

    :

    the input string

  #### Returns string

  - Defined in common/strings.ts:39

- promiseToString(p: Promise<any>): string

- #### Parameters

  - ##### p Promise<any>

  #### Returns string

  - Defined in common/strings.ts:59

- splitOnDelim(delim: string): (Anonymous function)

- Splits on a delimiter, but returns the delimiters in the array

- Splits on a delimiter, but returns the delimiters in the array

  #### Example:

      var splitOnSlashes = splitOnDelim('/');
      splitOnSlashes("/foo"); // ["/", "foo"]
      splitOnSlashes("/foo/"); // ["/", "foo", "/"]

  #### Parameters

  - ##### delim string

  #### Returns (Anonymous function)

  - Defined in common/strings.ts:138

- stringify(o: any): string

- #### Parameters

  - ##### o any

  #### Returns string

  - Defined in common/strings.ts:99

- stringifyPattern(value: any): string

- #### Parameters

  - ##### value any

  #### Returns string

  - Defined in common/strings.ts:81

- stripLastPathElement(str: string): string

- #### Parameters

  - ##### str string

  #### Returns string

  - Defined in common/strings.ts:122

- trimHashVal(str: string): string

- #### Parameters

  - ##### str string

  #### Returns string

  - Defined in common/strings.ts:126

Generated using TypeDoc