Google


ADBRITE ads links
You are here: CodeIdol.com > Php > PHP 5 in Practice > Strings

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

PHP 5 in Practice



1. Strings By far, most problems a developer encounters involve the manipulation of strings. Especially when used in a web environment, nearly all input and output to a PHP script are simply strings. It is no surprise then to find that the n...



1.1. Matching Patterns (Regular Expressions) Any discussion of string manipulation must include the use of regular expression pattern-matching functions (often referred to as regex). Regular expressions are a powerful minilanguage used to find com...



1.2. Cleaning Up Whitespace Often when dealing with data coming from a user, or perhaps from a database, you can have extra spaces (or tabs, carriage returns, and so on) in your strings. This often causes problems later when you want to compare st...



1.3. Expanding and Compressing Tabs It is a common practice for tabs to be used when writing text files. The problem is that different editors, and different computers, may show a tab as a different amount of space. This can cause no end of proble...



1.4. Converting Text Between Macintosh, UNIX, and PC Format Unfortunately in this world of multiple operating systems that we live in, sometimes slight differences end up causing major problems. Such is the case of line breaks in the various opera...



1.5. Parsing CSV (Comma-Separated Values) comma-separated value (CSV) is a common format for data to be inusually as an export/import option to get data from one system to another. PHP provides an excellent function, fgetcsv(), if you want to read...



1.6. Truncating Text to Fit Within a Specific Space When programming, you may often find yourself with a large block of text and yet a small area that it must fit in. A common tactic in these situations is to only display a certain number of the c...



1.7. Padding Arrays of Data to Display as Columns Often when programming for the Web you may find yourself needing to display an array of data as an HTML table. However, what can you do when you need to display this table of data as pure text? T...



1.8. Checking the Spelling of a Word It is handy to be able to check the spelling of a word entered by a user. In fact, any application that requires input of large amounts of text, such as a blog or email client, is expected to have some type of ...



1.9. Matching Similar Strings When a user performs a search through data for a term that he typed in, it is easy to misspell the term and end up getting no results. A technique sometimes called fuzzy matching can be used to prevent this. The idea ...



1.10. Performing Proper Capitalization on Titles You will sometimes find yourself in a situation where you need to print out a titlebe it the title of a book, of a report, or of a web page. The rules for capitalization in English are varied, depen...



1.11. Generating Unique Identifiers Often to solve a problem, you need to generate a unique identifier for something. This could be for a piece of data in a database, or perhaps to identify a user through the use of cookies. In any case, the prob...



1.12. Counting the Number of Times Certain Words Appear When dealing with a lot of text, you may find yourself needing to know how many times a certain word appears, or even how many times every word appears. Though there is no single built-in fun...


SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Php > PHP 5 in Practice > Strings
   
Related tags







Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......






© CodeIdol Labs, 2007