StringPadLeft
✖
StringPadLeft
makes string be of length n, padding it on the left with spaces or truncating it if necessary.
pads strings with spaces on the left to make them all the same length.
Details

- StringPadLeft effectively places repeated copies of padding to the left of string, truncating them when a total width of n characters has been achieved.
- StringPadLeft[BioSequence["type","seq"],n,…] will apply the operation to the string "seq", yielding a BioSequence result.
- The following letter is used as the default padding for each type of biomolecular sequence if not otherwise specified:
-
"DNA" or "CircularDNA" N "RNA" N "Peptide" X
Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Pad a string with whitespace to have total length 10:

https://wolfram.com/xid/0dqtkasrbv2-oi482r

Pad with a non-whitespace character:

https://wolfram.com/xid/0dqtkasrbv2-gwmhdb

Make a list of strings the same length:

https://wolfram.com/xid/0dqtkasrbv2-z11eow

Pad or truncate a list of strings to a given length:

https://wolfram.com/xid/0dqtkasrbv2-yxxo95

Wolfram Research (2015), StringPadLeft, Wolfram Language function, https://reference.wolfram.com/language/ref/StringPadLeft.html (updated 2020).
Text
Wolfram Research (2015), StringPadLeft, Wolfram Language function, https://reference.wolfram.com/language/ref/StringPadLeft.html (updated 2020).
Wolfram Research (2015), StringPadLeft, Wolfram Language function, https://reference.wolfram.com/language/ref/StringPadLeft.html (updated 2020).
CMS
Wolfram Language. 2015. "StringPadLeft." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringPadLeft.html.
Wolfram Language. 2015. "StringPadLeft." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringPadLeft.html.
APA
Wolfram Language. (2015). StringPadLeft. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringPadLeft.html
Wolfram Language. (2015). StringPadLeft. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringPadLeft.html
BibTeX
@misc{reference.wolfram_2025_stringpadleft, author="Wolfram Research", title="{StringPadLeft}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringPadLeft.html}", note=[Accessed: 08-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_stringpadleft, organization={Wolfram Research}, title={StringPadLeft}, year={2020}, url={https://reference.wolfram.com/language/ref/StringPadLeft.html}, note=[Accessed: 08-July-2025
]}