2017 © Pedro Peláez
 

library strings

image

rkr/strings

  • Monday, May 12, 2014
  • by rkr
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Consistent multibyte function library for strings

Design-goals

  • Consistent interface.
  • All names are lowerCamelCase.
  • Required parameters are always at the beginning.
  • Homogeneous parameters follow conventions: $haystack is always before $needle.
  • Proper null handling.

Functions

  • at
    \rkr\str\at(string|null string, int|null position): string|null_
    _Get the character at the specified position in a string.
  • bagDistance
    \rkr\str\bagDistance(string|null string1, string|null string2): int|null_
    _Calculate the bag distance between two strings.
  • capitalize
    \rkr\str\capitalize(string|null string): string|null_
    _Capitalize the first character of the string.
  • capitalizeWords
    \rkr\str\capitalizeWords(string|null string): string|null_
    _Capitalize the first letter of each word in a string.
  • characters
    \rkr\str\characters(string|null string): array|null_
    _Get the Unicode characters of a string.
  • chunk
    \rkr\str\chunk(string|null string, int length): array|null_
    _Splits a string into chunks of the given length.
  • contains
    \rkr\str\contains(string|null haystack, string|null needle): bool_
    _Check if a string contains another string.
  • duplicate
    \rkr\str\duplicate(string|null string, int times): string|null_
    _Duplicate a string a given number of times.
  • endsWith
    \rkr\str\endsWith(string|null haystack, string|null needle): bool_
    _Checks if the haystack ends with the needle.
  • equals
    \rkr\str\equals(string|null string1, string|null string2): bool_
    _Asserts that a string is equal to another string.
  • first
    \rkr\str\first(string|null string): string|null_
    _Get the first character of a string.
  • indexOf
    \rkr\str\indexOf(string|null haystack, string|null needle, int offset): int|null_
    _Finds the position of the first occurrence of a substring in a string.
  • jaroDistance
    \rkr\str\jaroDistance(string|null string1, string|null string2): float|null_
    _Calculate the Jaro distance between two strings.
  • last
    \rkr\str\last(string|null string): string|null_
    _Get the last character of a string.
  • lastIndexOf
    \rkr\str\lastIndexOf(string|null haystack, string|null needle, int offset): int|null_
    _Find the last occurrence of a string in another string.
  • length
    \rkr\str\length(string|null string): int|null_
    _Get the length of the string.
  • lower
    \rkr\str\lower(string|null string): string|null_
    _Converts a string to lowercase.
  • matches
    \rkr\str\matches(string|null string, string|null pattern): bool_
    _Check if a string matches a regular expression pattern.
  • myersDifference
    \rkr\str\myersDifference(string|null string1, string|null string2): int|null_
    _Calculate the Myers difference between two strings.
  • normalize
    \rkr\str\normalize(string|null string, string form): string|null_
    _Normalize a string using a specified normalization form.
  • padLeading
    \rkr\str\padLeading(string|null string, int length, string|null substring): string|null_
    _Pads the given string on the left side to the specified length with the specified character.
  • padTrailing
    \rkr\str\padTrailing(string|null string, positive-int length, string char): string|null_
    _Pads the given string to the specified length with the given character.
  • replace
    \rkr\str\replace(string|null haystack, string|null needle, string|null replacement): string|null_
    _Replace all occurrences of the needle in the haystack with the replacement.
  • replaceFirst
    \rkr\str\replaceFirst(string|null haystack, string|null needle, string|null replacement): string|null_
    _Replace the first occurrence of a needle in the haystack with a replacement.
  • replaceLast
    \rkr\str\replaceLast(string|null haystack, string|null needle, string|null replacement): string|null_
    _Replaces all occurrences of a string in another string.
  • replacePrefix
    \rkr\str\replacePrefix(string|null string, string|null prefix, string|null replacement): string|null_
    _Replace the prefix of a string with another string.
  • replaceSuffix
    \rkr\str\replaceSuffix(string|null string, string|null suffix, string|null replacement): string|null_
    _Replaces the suffix of a string.
  • reverse
    \rkr\str\reverse(string|null string): string|null_
    _Reverse a given string.
  • shift
    \rkr\str\shift(string|null string, positive-int length): null|array{: string, : string}_
    _Shifts a string by a given length.
  • startsWith
    \rkr\str\startsWith(string|null haystack, string|null needle): bool_
    _Checks if the haystack starts with the needle.
  • substr
    \rkr\str\substr(string|null string, int start, int|null length): string|null_
    _Get a substring of a string.
  • trim
    \rkr\str\trim(string|null string, string|null chars null): string|null_
    _Trims the given string by removing the specified characters from the beginning and the end.
  • trimLeft
    \rkr\str\trimLeft(string|null string, string|null chars null): string|null_
    _Trims the specified characters from the beginning of the string.
  • trimRight
    \rkr\str\trimRight(string|null string, string|null chars null): string|null_
    _Trims the specified characters from the end of the string.
  • upper
    \rkr\str\upper(string|null string): string|null_
    _Convert a string to uppercase.

The Versions

12/05 2014

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires

18/03 2014

0.0.1

0.0.1.0

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

The Development Requires