Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Truncate by Characters
Lab: Doing More With PHP String Processing
Video Runtime: 17:18
There are times when you want to truncate a string by a certain number of characters. You are limiting the string to say 100 or 200 characters. How do you do that? In this episode, you and I will build the utility function that will handle it for you. Then you just call it whenever you need that feature in your theme or plugin.
In this utility function, you used the following instructions:
Who needs copy/paste? Right. Writing code from scratch is fun!
Total Lab Runtime: 01:58:54
- 1 Lab Introductionfree 03:24
- 2 Checking if String Starts With a Character or Substringpro 13:43
- 3 Explaining the "String Starts With" Strategypro 13:35
- 4 Check if String Ends With a Character or Substring - Part 1pro 15:11
- 5 Check if String Ends With a Character or Substring - Part 2pro 12:52
- 6 Has Substringpro 04:27
- 7 Truncate by Characterspro 17:18
- 8 Truncate by Wordspro 14:35
- 9 Converting to Lowercasepro 07:58
- 10 Converting to Uppercasepro 01:30
- 11 Splitting a String into An Arraypro 07:17
- 12 Joining Array Elements into a Stringpro 03:43
- 13 Wrap it Uppro 03:21