-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
92 lines (53 loc) · 2.33 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ext/str
Set of utility functions for strings in PHP. I made those primarily
for personal entertainment. Most of that stuff isn't tested that well
(though there are unit tests available) and the API and the behaviour
of the functions is likely to change. You have been warned.
str_startswith(haystack, needle, [case_insensitive]) : bool
Returns true if the string haystack starts with the substring
needle. Returns false otherwise.
If the optional third parameter is set to true, the test is
performed in a case-insensitive manner.
str_endswith(haystack, needle, [case_insensitive]) : bool
Returns true if the string haystack ends with the substring
needle. Returns false otherwise.
If the optional third parameter is set to true, the test is
performed in a case-insensitive manner.
str_contains(haystack, needle, [case_insensitive]) : bool
Returns true if the string haystack contains the substring
needle. Returns false otherwise.
If the optional third parameter is set to true, the test is
performed in a case-insensitive manner.
str_isupper(input) : bool
Returns true if all cased characters in the given input string are
uppercase and if the string contains at least one cased character.
Returns false otherwise.
str_islower(input) : bool
Returns true if all cased characters in the given input string are
lowercase and if the string contains at least one cased character.
Returns false otherwise.
str_iswhitespace(input) : bool
Returns true if the given string is empty or contains whitespace
characters only. Returns false otherwise.
str_swapcase(input) : string
Returns the given string with uppercase characters converted to
their lowercase representations and vice versa.
License
-------
All the stuff in here is licensed under the New BSD License. See the
included LICENSE file for more info. Have fun!
Development notes
-----------------
Building
Should you run into issues regarding PHP's buildconf script at some point,
try forcing autoconf and autoheader to version 2.13. (Make sure those are
installed, of course.)
$ PHP_AUTOHEADER=autoheader213 PHP_AUTOCONF=autoconf213 ./buildconf
Not sure why those things still have to be so complicated in the 21st
century.
Running the tests
$ export TEST_PHP_EXECUTABLE=./sapi/cli/php
$ php run-tests.php ./ext/str/tests/
TODO / ideas
------------
* str_expandtabs(string) : string