I have a string like this:
" 23 PM"
I would like to remove 23 so I'm left with PM or (with space truncated) just PM.
Any suggestions?
Needs to be in PHP
I have a string like this:
" 23 PM"
I would like to remove 23 so I'm left with PM or (with space truncated) just PM.
Any suggestions?
Needs to be in PHP
trim() will allow a range of characters in the "character mask" parameter by using dot syntax.
Code: (Demo)
// v--------literal spaces
trim(" 23 PM", ' 0..9')
// ^^^^----all digits
// output: PM