Title: Pad string with characters
Last modified: November 27, 2021

---

# Pad string with characters

 *  [iantresman](https://wordpress.org/support/users/iantresman/)
 * (@iantresman)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/pad-string-with-characters/)
 * Is there a way to pad out a string variable to four characters? I have the following:
   `[
   set number]123[/set]` If it is less than four characters, I want to convert it
   to the string: `0123`

The topic ‘Pad string with characters’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [iantresman](https://wordpress.org/support/users/iantresman/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/pad-string-with-characters/)
 * Status: not resolved