Last active
April 27, 2016 19:43
-
-
Save Cxarli/cde2001f3daf6ffadf16e5d0c937681a to your computer and use it in GitHub Desktop.
A tester for StringPlus.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'StringPlus.inc'; | |
$string = new StringPlus("Hello World"); | |
print strval($string) . "\n"; | |
print "\n--- contains \n"; | |
print new StringPlus($string->contains("o W")) . "\t[true]\n"; | |
print new StringPlus($string->contains("o W", true)) . "\t[true]\n"; | |
print new StringPlus($string->contains("o w")) . "\t[false]\n"; | |
print new StringPlus($string->contains("o w", true)) . "\t[true]\n"; | |
print new StringPlus($string->contains("abc")) . "\t[false]\n"; | |
print new StringPlus($string->contains("abc", true)) . "\t[false]\n"; | |
print "\n--- startsWith \n"; | |
print new StringPlus($string->startsWith("Hello")) . "\t[true]\n"; | |
print new StringPlus($string->startsWith("Hello", true)) . "\t[true]\n"; | |
print new StringPlus($string->startsWith("hello")) . "\t[false]\n"; | |
print new StringPlus($string->startsWith("hello", true)) . "\t[true]\n"; | |
print new StringPlus($string->startsWith("World")) . "\t[false]\n"; | |
print new StringPlus($string->startsWith("World", true)) . "\t[false]\n"; | |
print "\n--- endsWith \n"; | |
print new StringPlus($string->endsWith("World")) . "\t[true]\n"; | |
print new StringPlus($string->endsWith("World", true)) . "\t[true]\n"; | |
print new StringPlus($string->endsWith("world")) . "\t[false]\n"; | |
print new StringPlus($string->endsWith("world", true)) . "\t[true]\n"; | |
print new StringPlus($string->endsWith("Hello")) . "\t[false]\n"; | |
print new StringPlus($string->endsWith("Hello", true)) . "\t[false]\n"; | |
print "\n--- test\n"; | |
print new StringPlus($string->test('/[a-z]/')) . "\t[true]\n"; | |
print new StringPlus($string->test('/[0-9]/')) . "\t[false]\n"; | |
print new StringPlus($string->test('/[ ]/')) . "\t[true]\n"; | |
print new StringPlus($string->test('/^[eo dhlrw]{1,}$/')) . "\t[false]\n"; | |
print new StringPlus($string->test('/^[eo dhlrw]{1,}$/i')) . "\t[true]\n"; | |
// Appreciate this please. I spent a long time making it | |
print new StringPlus($string->test('/^(.)([^\1])([^\2])(\3)([^\3])\W([^\5])(\5)([^\6])(\3)([^\9])$/')) . "\t[true]\n"; | |
print "\n--- lowercase \n"; | |
print $string->lowercase() . "\t[hello world]\n"; | |
print "\n--- uppercase \n"; | |
print $string->uppercase() . "\t[HELLO WORLD]\n"; | |
print "\n--- length \n"; | |
print $string->length() . "\t[11]\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Framework: https://gist.github.com/C-Bouthoorn/fe30cfdc2135d2a2e8b6824f3b4e437b