Commit f7d0b437 authored by Taylor Otwell's avatar Taylor Otwell

Merge pull request #1278 from Jakobud/feature/doc/strings

Added output from examples to String documentation
parents d0890461 e67ddd86
......@@ -14,22 +14,29 @@
The **Str** class also provides three convenient methods for manipulating string capitalization: **upper**, **lower**, and **title**. These are more intelligent versions of the PHP [strtoupper](http://php.net/manual/en/function.strtoupper.php), [strtolower](http://php.net/manual/en/function.strtolower.php), and [ucwords](http://php.net/manual/en/function.ucwords.php) methods. More intelligent because they can handle UTF-8 input if the [multi-byte string](http://php.net/manual/en/book.mbstring.php) PHP extension is installed on your web server. To use them, just pass a string to the method:
echo Str::lower('I am a string.');
// i am a string.
echo Str::upper('I am a string.');
// I AM A STRING.
echo Str::title('I am a string.');
// I Am A String.
<a name="limits"></a>
## Word & Character Limiting
#### Limiting the number of characters in a string:
echo Str::limit($string, 10);
echo Str::limit_exact($string, 10);
echo Str::limit("Lorem ipsum dolor sit amet", 10);
// Lorem ipsu...
echo Str::limit_exact("Lorem ipsum dolor sit amet", 10);
// Lorem i...
#### Limiting the number of words in a string:
echo Str::words($string, 10);
echo Str::words("Lorem ipsum dolor sit amet", 3);
// Lorem ipsum dolor...
<a name="random"></a>
## Generating Random Strings
......@@ -45,17 +52,17 @@ The **Str** class also provides three convenient methods for manipulating string
<a name="singular-and-plural"></a>
## Singular & Plural
The String class is capable of transforming your strings from singular to plural, and vice versa.
#### Getting the plural form of a word:
echo Str::plural('user');
// users
#### Getting the singular form of a word:
echo Str::singular('users');
// user
#### Getting the plural form if given value is greater than one:
#### Getting the plural form if specified value is greater than one:
echo Str::plural('comment', count($comments));
......@@ -65,8 +72,10 @@ The String class is capable of transforming your strings from singular to plural
#### Generating a URL friendly slug:
return Str::slug('My First Blog Post!');
// my-first-blog-post
#### Generating a URL friendly slug using a given separator:
return Str::slug('My First Blog Post!', '_');
// my_first_blog_post
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment