# util/StringHelper.php

String helper utility class.

This class includes some Java-like functions for parsing strings, as well as some functions for getting qualifiers / unqualifying phing-style classpaths. (e.g. "phing.util.StringHelper").

Author
  Hans Lellelid
Package
  phing.system.util

## \StringHelper
jump to top

Package: phing\system\util

String helper utility class.

This class includes some Java-like functions for parsing strings, as well as some functions for getting qualifiers / unqualifying phing-style classpaths. (e.g. "phing.util.StringHelper").

Author
  Hans Lellelid

### Properties

`$FALSE_VALUES= 'array("off"'`
static
Default value `array("off"`Details

Type

`$TRUE_VALUES= 'array("on"'`
static
Default value `array("on"`Details

Type

### Methods

`booleanValue( $s ) : boolean`
static

Parameters

Name | Type | Description
--- | --- | ---
$s |  |

Returns

Type | Description
--- | ---
boolean |

`endsWith( $check, $string ) : void`
static

tests if a string ends with a given string

Parameters

Name | Type | Description
--- | --- | ---
$check |  |
$string |  |

`hashCode( $string ) : int`
static

Parameters

Name | Type | Description
--- | --- | ---
$string |  |

Returns

Type | Description
--- | ---
int |

`isBoolean( $s ) : void`
static

tests if a string is a representative of a boolean

Parameters

Name | Type | Description
--- | --- | ---
$s |  |

`isSlotVar( string $value ) : void`
static

Does the value correspond to a slot variable?

Parameters

Name | Type | Description
--- | --- | ---
$value | string |

`key( ) : string`
static

Creates a key based on any number of passed params.

Returns

Type | Description
--- | ---
string |

`multiply( array $strings, array $tokens, array $replacements ) : string`
static

Replaces identifier tokens with corresponding text values in passed string.

Parameters

Name | Type | Description
--- | --- | ---
$strings | array | Array of strings to multiply. (If string is passed, will convert to array)
$tokens | array | The tokens to search for.
$replacements | array | The values with which to replace found tokens.

Returns

Type | Description
--- | ---
string |

`prefix( array $columns, string $prefix ) : array`
static

Parameters

Name | Type | Description
--- | --- | ---
$columns | array | String[]
$prefix | string |

Returns

Type | Description
--- | ---
array | String[]

`qualifier( $qualifiedName, $seperator = '.' ) : string`
static

Get the qualifier part of a qualified name.

E.g. eg.Cat -> eg

Parameters

Name | Type | Description
--- | --- | ---
$qualifiedName |  |
$seperator |  |

Returns

Type | Description
--- | ---
string |

`root( $qualifiedName, $separator = '.' ) : string`
static

Parameters

Name | Type | Description
--- | --- | ---
$qualifiedName |  |
$separator |  |

Returns

Type | Description
--- | ---
string |

`slotVar( string $var ) : string`
static

Extracts the variable name for a slot var in the format %{task.current_file}

Parameters

Name | Type | Description
--- | --- | ---
$var | string | The var from build file.

Returns

Type | Description
--- | ---
string | Extracted name part.

`startsWith( $check, $string ) : void`
static

tests if a string starts with a given string

Parameters

Name | Type | Description
--- | --- | ---
$check |  |
$string |  |

`substring( $string, $startpos, $endpos = -1 ) : void`
static

a natural way of getting a subtring, php's circular string buffer and strange return values suck if you want to program strict as of C or friends

Parameters

Name | Type | Description
--- | --- | ---
$string |  |
$startpos |  |
$endpos |  |

`toCharArray( $str ) : array`
static

Converts a string to an indexed array of chars There's really no reason for this to be used in PHP, since strings are all accessible using the $string{0} notation.

Parameters

Name | Type | Description
--- | --- | ---
$str |  |

Returns

Type | Description
--- | ---
array |

Details

Deprecated

`unqualify( string $qualifiedName, string $separator = '.' ) : void`
static

Remove qualification to name.

E.g. eg.Cat -> Cat

Parameters

Name | Type | Description
--- | --- | ---
$qualifiedName | string |
$separator | string | Character used to separate.

Documentation was generated by DocBlox 0.15.1.