StringPadRight

StringPadRight["string",n]

makes string be of length n, padding it on the right with spaces or truncating it if necessary.

StringPadRight["string",n,"padding"]

pads by repeating copies of the string padding.

StringPadRight[{"s1","s2",}]

pads strings with spaces on the right to make them all the same length.

StringPadRight[{"s1","s2",},n,]

pads or truncates to make all strings of length n.

Details

  • StringPadRight effectively places repeated copies of padding to the right of string, truncating them when a total width of n characters has been achieved.
  • StringPadRight[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 all

Basic Examples  (4)

Pad a string with whitespace to have total length 10:

Pad with a non-whitespace character:

Make a list of strings the same length:

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

Scope  (2)

Pad a DNA sequence with characters representing an unknown downstream sequence:

Pad a DNA sequence with a particular letter:

Wolfram Research (2015), StringPadRight, Wolfram Language function, https://reference.wolfram.com/language/ref/StringPadRight.html (updated 2020).

Text

Wolfram Research (2015), StringPadRight, Wolfram Language function, https://reference.wolfram.com/language/ref/StringPadRight.html (updated 2020).

CMS

Wolfram Language. 2015. "StringPadRight." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringPadRight.html.

APA

Wolfram Language. (2015). StringPadRight. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringPadRight.html

BibTeX

@misc{reference.wolfram_2024_stringpadright, author="Wolfram Research", title="{StringPadRight}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringPadRight.html}", note=[Accessed: 18-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_stringpadright, organization={Wolfram Research}, title={StringPadRight}, year={2020}, url={https://reference.wolfram.com/language/ref/StringPadRight.html}, note=[Accessed: 18-December-2024 ]}