This documentation is for not yet released version of ytt. For the documentation of the latest release version, see the latest version.
Strings
name1: #@ name + "-deployment"
name2: #@ "{}-deployment".format("name")
Copied here for convenience from Starlark specification.
- string·elem_ords
 - string·capitalize (
S.capitalize()) 
"hello, world!".capitalize()  # "Hello, world!"`
- string·codepoint_ords
 - string·count (
S.count(sub[, start[, end]])) 
"hello, world!".count("o")         # 2
"hello, world!".count("o", 7, 12)  # 1  (in "world")
- string·endswith (
S.endswith(suffix[, start[, end]])) 
"filename.star".endswith(".star")  # True
'foo.cc'.endswith(('.cc', '.h'))   # True
- string·find (
S.find(sub[, start[, end]])) 
"bonbon".find("on")        # 1
"bonbon".find("on", 2)     # 4
"bonbon".find("on", 2, 5)  # -1
- string·format (
S.format(*args, **kwargs)) 
"a{x}b{y}c{}".format(1, x=2, y=3)   # "a2b3c1"
"a{}b{}c".format(1, 2)              # "a1b2c"
"({1}, {0})".format("zero", "one")  # "(one, zero)"
- string·index (
S.index(sub[, start[, end]])) 
"bonbon".index("on")        # 1
"bonbon".index("on", 2)     # 4
"bonbon".index("on", 2, 5)  # error: substring not found (in "nbo")
"base64".isalnum()    # True
"Catch-22".isalnum()  # False
- string·isalpha
 - string·isdigit
 - string·islower
 - string·isspace
 - string·istitle
 - string·isupper
 - string·join (
S.join(iterable)) 
", ".join(["one", "two", "three"])  # "one, two, three"
"a".join("ctmrn".codepoints())      # "catamaran"
"  hello  ".lstrip()  # "hello  "
- string·partition
 - string·replace (
S.replace(old, new[, count])) 
"banana".replace("a", "o")     # "bonono"
"banana".replace("a", "o", 2)  # "bonona"
- string·rfind (
S.rfind(sub[, start[, end]])) 
"bonbon".rfind("on")           # 4
"bonbon".rfind("on", None, 5)  # 1
"bonbon".rfind("on", 2, 5)     # -1
- string·rindex (
S.rindex(sub[, start[, end]])) - string·rpartition
 - string·rsplit
 - string·rstrip (
S.rstrip()) 
"  hello  ".rstrip()  # "  hello"
- string·split (
S.split([sep [, maxsplit]])) 
"one two  three".split()         # ["one", "two", "three"]
"one two  three".split(" ")      # ["one", "two", "", "three"]
"one two  three".split(None, 1)  # ["one", "two  three"]
"banana".split("n")              # ["ba", "a", "a"]
"banana".split("n", 1)           # ["ba", "ana"]
- string·elems
 - string·codepoints
 - string·splitlines (
S.splitlines([keepends])) 
"one\n\ntwo".splitlines()      # ["one", "", "two"]
"one\n\ntwo".splitlines(True)  # ["one\n", "\n", "two"]
- string·startswith (
S.startswith(prefix[, start[, end]])) 
"filename.star".startswith("filename")  # True`
- string·strip (
S.strip()) 
"  hello  ".strip()  # "hello"
- string·title
 - string·upper (
S.upper()) 
"Hello, World!".upper()  # "HELLO, WORLD!"
(Help improve our docs: edit this page on GitHub)
#carvel in Kubernetes Slack