Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Checking if String Starts With a Character or Substring
Lab: Doing More With PHP String Processing
Video Runtime: 13:43
In this episode, we’ll take on the challenge of how to test a string to see if it starts with “http://”. You’ll discover there are multiple ways to do this check. Then we’ll create a utility function called starts_with
and put that into our new Site Utilities plugin.
Regex is not needed here. In this episode, I show you two different approaches to checking if a string begins with a substring:
Don’t repeat yourself. Don’t repeat yourself. Don’t repeat yourself.
Episodes
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