Skip to content

Commit

Permalink
Update README for MutableAttributedString
Browse files Browse the repository at this point in the history
  • Loading branch information
apemsel committed Feb 22, 2016
1 parent c892a77 commit c59526b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@ A class to work with attributed strings in PHP. Attributed strings are strings t

$as->searchAttribute("vowel"); // 2, first vowel starts at offset 2
$as->searchAttribute("vowel", 0, true); // [2, 1], first vowel starting at offset 0 is at offset 2 with length 1

// MutableAttributedString can be modified after creation and tries to be smart about the attributes
$mas = new MutableAttributedString("The brown fox");
$mas->setLength(0, 13, "bold");
$mas->insert(4, "quick "); // "The quick brown fox";
$mas->is("underlined", 6) // true, "quick" is now also bold since the inserted text was inside the "bold" attribute
$mas->delete(10, 6) // "The quick fox"
```

0 comments on commit c59526b

Please sign in to comment.