Page 1
Generated Documentation
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 2
Contents
Package MiscString Procedural Elements
2
miscstring.php
2
Package MiscString Classes
3
Class strNormal
3
Method camelize
3
Method camelToNormal
3
Method methodize
4
Method normalize
4
Method underscores
4
Method variablize
4
Class strUnicode
5
Method strlen
5
Method substr
5
Class strWhitespace
5
Method htmlHardSpaces
6
Method normalizeNewlines
6
Method normalizeSpace
6
Method normalizeWhitespace
6
Method setTabWidth
7
Method spacesToTabs
7
Method stripEmptyLines
7
Method stripNewlines
7
Method tabsToSpaces
7
Package Test Procedural Elements
10
normal.php
10
unicode.php
11
whitespace.php
12
Appendices
13
Appendix A - Class Trees
14
MiscString
14
Test
14
Appendix B - README/CHANGELOG/INSTALL
15
README
16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 3
Page 1 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 4
Package MiscString Procedural Elements
miscstring.php
This file contains 3 classes - strUnicode, strNormal and strWhitespace.
The classes are independent, so you can easily use them to extend your own classes.
You are free to use this code as you see fit.
Created on 12-Nov-06
Package MiscString
Author Vladislav Bailovic < malatestapunk@gmail.com>
Page 2 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 5
Package MiscString Classes
Class strNormal
[line 176]
Various common string normalization methods.
Package MiscString
Author Vladislav Bailovic < malatestapunk@gmail.com>
string function strNormal::camelize($s, [$cfl = false]) [line 187]
Function Parameters:
string $s String to convert
bool $cfl /ConvertFirstLetter/ If set, first letter will be in lowercase.
Converts space-, dash-, underscore-, or otherwise delimited string into CamelCased
(or camelCased) version. Not Unicode-safe.
string function strNormal::camelToNormal($s) [line 258]
Function Parameters:
string $s String to convert
Converts camelized string to normal (all lowercase, underscore- separated words)
representation. Not Unicode-safe.
Page 3 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 6
string function strNormal::methodize($s) [line 228]
Function Parameters:
string $s String to convert
Convert given string to a valid method name (valid php fnc. name, camelCased). Not
Unicode-safe.
string function strNormal::normalize($s) [line 214]
Function Parameters:
string $s String to convert
Normalizes a string (all lowercase, underscore- separated words).
Not Unicode-safe.
string function strNormal::underscores($s) [line 201]
Function Parameters:
string $s String to convert
Replaces non-word characters with underscores. Not Unicode-safe.
string function strNormal::variablize($s) [line 242]
Function Parameters:
string $s String to convert
Converts string to a normalized valid PHP varname. Not Unicode-safe.
Page 4 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 7
Class strUnicode
[line 23]
Unicode-safe basic string manipulation.
Some PHP string manipulation functions don't work well with multibyte strings, so here
are their replacements.
Package MiscString
Author Vladislav Bailovic < malatestapunk@gmail.com>
int function strUnicode::strlen($s) [line 53]
Function Parameters:
string $s s String to check
Count Unicode string length.
Works just like strlen(), except that it handles Unicode strings better.
string function strUnicode::substr($s, [$start = 0], [$length = false]) [line 34]
Function Parameters:
string $s s String to extract from
int $start start Where to start substring extraction
int $length length Substring length
Unicode-safe substr() port.
Works just like substr(), except that it handles Unicode strings better.
Class strWhitespace
[line 65]
Page 5 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 8
Whitespace normalization methods.
Package MiscString
Author Vladislav Bailovic < malatestapunk@gmail.com>
string function strWhitespace::htmlHardSpaces($s) [line 162]
Function Parameters:
string $s String to convert
Replaces all double spaces spaces with &nbsp;.
string function strWhitespace::normalizeNewlines($s) [line 91]
Function Parameters:
string $s String to convert
Normalizes newlines - converts all \r and \r\n pairs to \n.
string function strWhitespace::normalizeSpace($s) [line 101]
Function Parameters:
string $s String to convert
Replaces multiple space characters with single one.
string function strWhitespace::normalizeWhitespace($s) [line 111]
Function Parameters:
string $s String to convert
Replaces all multiple whitespace characters with single space.
Page 6 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 9
bool function strWhitespace::setTabWidth($width) [line 79]
Function Parameters:
int $width width New tab width
Sets default tab width.
string function strWhitespace::spacesToTabs($s) [line 142]
Function Parameters:
string $s String to convert
Replaces all tabs with default number of spaces.
string function strWhitespace::stripEmptyLines($s) [line 132]
Function Parameters:
string $s String to convert
Strips empty lines.
string function strWhitespace::stripNewlines($s) [line 121]
Function Parameters:
string $s String to convert
Replaces all newlines with spaces.
string function strWhitespace::tabsToSpaces($s) [line 152]
Function Parameters:
string $s String to convert
Page 7 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 10
Replaces all default numbers of spaces with tabs.
Page 8 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 11
Page 9 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 12
Package Test Procedural Elements
normal.php
This is a test file for strNormal class from MiscString package.
Run this file in your browser and submit some text.
Package Test
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../miscstring.php'[line 11]
Page 10 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 13
unicode.php
This is a test file for strUnicode class from MiscString package.
Run this file in your browser and submit some text.
Package Test
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../miscstring.php'[line 11]
Page 11 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 14
whitespace.php
This is a test file for strWhitespace class from MiscString package.
Run this file in your browser and submit some text.
Package Test
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../miscstring.php'[line 11]
Page 12 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 15
Appendices
Page 13 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 16
Appendix A - Class Trees
Package MiscString
strNormal
strNormal
strUnicode
strUnicode
strWhitespace
strWhitespace
Package Test
Page 14 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 17
Appendix B -
README/CHANGELOG/INSTALL
Page 15 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 18
README
* What is this?
-----------------------------------------
MiscString is a package that provides:
a) class strUnicode: Unicode-safe ports of PHP strlen() and substr()
functions. This does NOT require mb_string or iconv extensions.
b) class strNormal: String normalization - by camelCasing or
under_scoring.
c) class strWhitespace: Whitespace normalization - tabs, newlines,
spaces.
* What do I need to run this?
-----------------------------------------
Absolutely nothing (working PHP install aside). It should just work.
* How do I use this?
------------------------------------------------------
Check the examples in "examples" directory. You can also take a look at
comments in the source, or run PhpDocumentor (http://www.phpdoc.org)
over it to get a more readable documentation.
* Aaargh! I've found a bug!
- OR -
* This stuff is working fine for me.
- OR -
* Dis nuh workin.
- OR -
* Dude, I think you rock!
------------------------------------------------------
Let me know: malatestapunk@gmail.com
Page 16 of 16
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 19
Index
M
miscstring.php
2
This file contains 3 classes - strUnicode, strNormal and strWhitespace.
N
normal.php
10
This is a test file for strNormal class from MiscString package.
R
README
16
S
strWhitespace::normalizeWhitespace()
6
Replaces all multiple whitespace characters with single space.
strWhitespace::normalizeSpace()
6
Replaces multiple space characters with single one.
strWhitespace::normalizeNewlines()
6
Normalizes newlines - converts all \r and \r\n pairs to \n.
strWhitespace::htmlHardSpaces()
6
Replaces all double spaces spaces with &nbsp;.
strWhitespace::setTabWidth()
7
Sets default tab width.
strWhitespace::spacesToTabs()
7
Replaces all tabs with default number of spaces.
strWhitespace::tabsToSpaces()
7
Replaces all default numbers of spaces with tabs.
strWhitespace::stripNewlines()
7
Replaces all newlines with spaces.
strWhitespace::stripEmptyLines()
7
Strips empty lines.
strWhitespace
5
Whitespace normalization methods.
strUnicode::substr()
5
Unicode-safe substr() port.
strNormal::methodize()
4
Convert given string to a valid method name (valid php fnc. name,
camelCased). Not Unicode-safe.
strNormal::camelToNormal()
3
Converts camelized string to normal (all lowercase,
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 20
underscore- separated words) representation. Not Unicode-safe.
strNormal::camelize()
3
Converts space-, dash-, underscore-, or otherwise delimited string into
CamelCased (or camelCased) version. Not Unicode-safe.
strNormal::normalize()
4
Normalizes a string (all lowercase, underscore- separated words).
strNormal::underscores()
4
Replaces non-word characters with underscores. Not Unicode-safe.
strUnicode::strlen()
5
Count Unicode string length.
strUnicode
5
Unicode-safe basic string manipulation.
strNormal::variablize()
4
Converts string to a normalized valid PHP varname. Not Unicode-safe.
strNormal
3
Various common string normalization methods.
U
unicode.php
11
This is a test file for strUnicode class from MiscString package.
W
whitespace.php
12
This is a test file for strWhitespace class from MiscString package.
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu