Skip to content

str

text

1
# str: text in double quotes
2
"héllo\tworld"
3
# in double quotes
4
"hello"
5
# with values inside braces
6
"1 + 1 = {1 + 1}""1 + 1 = 2"
Example outputCtrl+Enter to run
1
# + joins, * repeats
2
"ab" * 3"ababab"
3
# s[i] and s[a..b] pick characters
4
"hello"[1..3]"el"
Example outputCtrl+Enter to run
  • warn print a warning to stderr, dimmed in a terminal, and carry on
  • fail stop with an error message
  • edit open a full-screen editor to type or paste text into, starting from text
  • int convert to an integer, dropping any fractional part
  • float convert to a float
  • list convert to a list: a string’s characters, a map’s [key, value] pairs, a set’s items, a table’s rows as maps, or a copy of a list
  • desugar show what shell-style command lines mean: src with each one rewritten as the ordinary zil call it runs
  • parsed how src groups, with each operation that is an operand of another in parentheses
  • parse read a value written in zil syntax from text: a number, string, list, map or quantity
  • search functions whose name or description mentions a word, as text
  • read the contents of one or more files, as text joined into one string, or as bytes with the bytes flag
  • read_file the contents of one or more files, joined into one string
  • read_bytes a file’s contents, as bytes, for files that aren’t text
  • save_session write the session’s variables, functions and units to a file as code that rebuilds them
  • exists whether a file or directory exists
  • is_dir whether path is a directory (folder)
  • ls what’s in a directory, as a table of name, type, size and modified
  • du the biggest files and folders directly in dir, largest first, with each folder counted for everything inside it
  • glob every path that matches the pattern pat, as a table like ls gives
  • file_size a file’s size, as a quantity in bytes
  • mtime when a file was last changed, as a date
  • rm delete files and empty directories
  • mv move or rename files and directories
  • cp copy files
  • mkdir create directories, along with any missing folders above them
  • abspath the full path from the root of the file system, filling in the current directory
  • cd change the current directory and return the new one
  • env the value of an environment variable, or nil if it isn’t set
  • sh run a command line through the system shell (sh, or cmd on Windows) and return what it printed, without the final newline
  • run run a command line through the system shell and return {code, out, err}: its exit code, output and error output
  • open open a file or folder with the system’s default program, and return its path
  • fetch download a URL and return its content as a string
  • upper the string in UPPERCASE
  • lower the string in lowercase
  • trim remove spaces, tabs and newlines from both ends
  • capitalize make the first character uppercase
  • split split into a list of pieces wherever sep appears (a string or a regex)
  • from_words an English number in words, like “three hundred twelve”, as an integer
  • lines split into a list of lines
  • chars split into a list of single characters
  • replace replace every match of pat with the given text
  • starts_with whether s starts with prefix
  • ends_with whether s ends with suffix
  • match the first match of a regex, or nil if there’s none
  • find_all a list of every match of pat
  • grep the lines of a string, or items of a list, that contain pat
  • repeat the string repeated n times
  • nums every number found in a string, as a list of numbers
  • strip_ansi remove the hidden codes that color terminal text or move the cursor, leaving the plain text
  • truncate shorten to at most n characters, ending in … if anything was cut
  • wrap break lines between words so none is longer than width characters
  • dedent remove the indentation that every non-blank line has in common
  • title Capitalize The First Letter Of Each Word
  • snake rewrite as snake_case: lowercase words joined by _
  • camel rewrite as camelCase: words joined with no separator, each after the first capitalized
  • kebab rewrite as kebab-case: lowercase words joined by -
  • slug a lowercase version for use in a URL: only letters and digits, with - between words
  • words a list of the words, with punctuation removed except apostrophes
  • wc count lines, words and bytes, like the Unix wc tool
  • word_count how many words there are, counted as words does
  • distance the edit distance: how many single-character changes turn a into b
  • hamming how many positions two equal-length strings differ at, the Hamming distance
  • similarity how alike two strings are, from 1 (identical) to 0 (nothing in common)
  • closest the option with the smallest edit distance to s, ignoring upper and lower case, or nil for an empty list
  • diff what changed from text a to b, line by line, or nil if nothing did
  • translate translate text into the language to, named by code or English name, like “es”, “zh-CN” or “spanish”
  • base64 encode a string’s UTF-8 bytes in base64, the most common way to send binary data as plain text, in emails, URLs or JSON
  • base32 encode a string’s UTF-8 bytes in base32, which avoids mixing upper and lower case
  • base58 encode a string’s UTF-8 bytes in base58, which avoids look-alike characters such as 0 and O, as Bitcoin addresses do
  • url_encode make a string safe to put in a URL, replacing other characters with % and their hex code, like %20 for a space
  • unicode each character’s code point in the standard U+ form, like U+00E9 for é
  • encode encode bytes, or a string’s UTF-8 bytes, in the named format
  • decode decode text in a format encode writes, the reverse of encode
  • decode_auto try every format decode knows, plus rot13, bytes written as binary, octal or decimal numbers, and single-byte XOR, layer on layer up to depth deep, and list the text that comes out, the most English-looking first
  • flag_find find CTF flags, prefix up to the next }, in bytes or text: as they are, and in what decode_auto’s decodings make of each run of printable text, up to 3 layers deep
  • from_byte_text bytes written out as numbers separated by spaces or commas, in binary, octal, decimal or hex
  • ord the Unicode code point (number) of a single character
  • bytes a string’s UTF-8 bytes, bytes made from a list of integers 0-255, or an integer’s bytes
  • byte_len how many bytes the text takes in UTF-8, rather than how many characters it has
  • hexdump bytes shown as a hex dump, like the xxd tool, or just n bytes around address at
  • strings the readable text hidden in binary data: every run of at least min printable characters, like the Unix tool
  • entropy how unpredictable the bytes are (Shannon entropy)
  • sha1 the SHA-1 hash, in hex
  • sha256 the SHA-256 hash, in hex
  • sha512 the SHA-512 hash, in hex
  • md5 the MD5 hash, in hex
  • hmac the HMAC of s with the secret key, in hex
  • hash_id what kind of hash this looks like, from its length and format, likeliest first
  • hash_match the candidate whose hash is this one, or nil, hashing each with every algorithm hash_id suggests that zil has
  • crc32 the CRC-32 checksum, as an integer, the same one zip files and PNG images use
  • path_join join pieces into one path, with / or \ between them as your system uses
  • basename the last part of a path, usually the file name, or nil
  • dirname everything before the last part of a path, usually its folder, or nil
  • ext the file’s extension without the dot, like “gz”, or nil if it has none
  • stem the file name without its last extension, or nil
  • caesar the Caesar cipher: move each letter shift places along the alphabet, wrapping from z back to a
  • rot13 move each letter 13 places along the alphabet
  • atbash swap each letter with its mirror in the alphabet: a with z, b with y, and so on
  • vigenere the Vigenère cipher: a Caesar shift that changes with each letter, taken in turn from the letters of the key (a shifts by 0, b by 1, …)
  • unvigenere decrypt text encrypted with vigenere and the same key
  • caesar_solve every Caesar shift of s, the most English-looking first, as a table of shift and text
  • substitution_solve find the key of a simple substitution cipher (each letter always swapped for the same other letter) by hill climbing, assuming English, and return {key, text}
  • affine the affine cipher: letter number x (a = 0) becomes a × x + b, wrapping around the alphabet
  • unaffine decrypt text encrypted with affine and the same a and b
  • rail_fence the rail fence cipher: write s in a zigzag down and up n rails, then read it off one rail at a time
  • unrail_fence decrypt text encrypted with rail_fence and the same number of rails
  • bacon Bacon’s cipher: each letter as five A’s and B’s, its place in the alphabet in binary (a = AAAAA, b = AAAAB, …)
  • unbacon decode Bacon’s cipher: the A’s and B’s in s, in groups of five, back to letters
  • morse text to Morse code, or Morse code back to text
  • braille text to Braille characters, one per letter (uncontracted Grade 1), or Braille back to text
  • freq how often each symbol appears in s, as a table of symbol, count and percent, the most common first
  • ngrams every run of n symbols in s with how often it appears, as a table of gram and count, the most common first
  • ioc the index of coincidence of s: the chance that two symbols picked from it at random are the same
  • chi_squared how far the letters of s are from English letter frequencies, as a chi-squared value, where lower is closer
  • friedman the length of a repeating key, estimated from the index of coincidence by Friedman’s formula
  • key_lengths each key length up to max with the average index of coincidence of the columns it splits s into, as a table of length and ioc, the highest first
  • kasiski the Kasiski examination of s: runs of n symbols that appear more than once, and the key lengths their distances point to, as {repeats, factors}
  • vigenere_solve find the key of a Vigenère cipher by finding its length, then solving each Caesar shift by letter frequencies, assuming English, and return {key, text}
  • analyze a quick look at the statistics of s, as a map of length, symbols, entropy, ioc, chi_squared, top and likely
  • nato spell text out in the NATO phonetic alphabet (Alfa, Bravo, Charlie, …), as used over the phone or radio
  • aes_encrypt encrypt with AES, the standard block cipher, in mode “ecb”, “cbc”, “ctr” or “gcm”
  • aes_decrypt decrypt AES, the reverse of aes_encrypt with the same key, mode and IV
  • des_encrypt encrypt with DES, or Triple DES given a 16- or 24-byte key, in mode “ecb”, “cbc” or “ctr”
  • des_decrypt decrypt DES or Triple DES, the reverse of des_encrypt
  • chacha20 encrypt or decrypt with ChaCha20 (RFC 8439), a 32-byte key and a 12-byte nonce, as the same call does both
  • rc4 encrypt or decrypt with RC4, as the same call does both
  • mock aLtErNaTiNg CaSe, the internet’s way of quoting someone sarcastically
  • leet l33t sp34k: letters swapped for look-alike digits
  • uwu rewrite text in cutesy internet “uwu” speak
  • pig_latin translate to Pig Latin, the word game where the first consonants move to the end and “ay” is added
  • zalgo Z̷a̸l̵g̶o̴ text: pile random accent marks onto every character
  • flip turn text upside down, using look-alike characters in reverse order
  • style swap letters and digits for Unicode look-alikes, like bold or script
  • emoji the emoji with that name, like “taco”, or nil if there’s none
  • emojify replace :name: codes in text with their emoji, as chat apps do
  • len how many items a list, map or set has, characters a string has, or bytes a bytes value has
  • contains whether x is in v: text (or a regex match) in a string, an item in a list or set, or a key in a map
  • find the position of the first x in v, counting from 0, or nil if it isn’t there
  • count how many times x appears in a string or list
  • reverse reverse a string or list
  • take the first n items or characters
  • drop everything except the first n items or characters
  • set a set of a list’s items or a string’s characters, or of all the arguments, with repeats dropped
  • from_json read JSON text into zil values: objects become maps, arrays lists, and null nil
  • from_csv read CSV (comma-separated) text
  • hex an integer in hex, the same as v to hex
  • from_base the integer written in text in a base from 2 to 62, or in your own digits, the reverse of to_base
  • phone_digits the digits that a phone keypad gives letters, so “FLOWERS” is “3569377”
  • column_number the column number, counting from 1, of spreadsheet column letters
  • roman a positive integer as a Roman numeral, or a numeral back to an integer
  • roll roll dice written as in tabletop games, like “3d6+2”, and return {total, rolls}
  • eight_ball an answer from a Magic 8-Ball toy
  • yes_or_no a random “yes” or “no”, a little more likely to be yes on Fridays
  • density the typical density of an ingredient in g/mL, so a volume times it gives a mass
  • date a date from text: ISO (2026-12-25), US (12/25/2026), written out (Dec 25 2026) or plain English (next friday at 5pm, 3 days ago)
  • format a date as text laid out by strftime codes, such as %Y for the year, %m the month, %d the day, %H:%M the time and %B the month’s name
  • next the first date after d that falls on the given weekday, never d itself
  • cron a cron schedule in plain English
  • clock the time right now in each zone or city
  • sunrise when the sun rises at a place on a day, or nil if it doesn’t rise or doesn’t set that day
  • sunset when the sun sets at a place on a day, or nil if it doesn’t rise or doesn’t set that day
  • day_length how long the sun is up at a place on a day: 0 h if it never rises, 24 h if it never sets
  • country facts about a country, found by name or ISO code
  • city facts about a city
  • great_circle the distance between two places along the Earth’s surface, the shortest route, which is roughly the one planes fly
  • bearing the compass direction to set off in from one place to reach another, in degrees clockwise from north (90 is east)
  • zipcode look up a postal code online
  • jwt decode a JSON Web Token, the login token many websites and APIs send, into {header, payload, signature}
  • jwt_verify whether a JSON Web Token’s HMAC signature matches the key
  • url_parse split a URL into its parts: {scheme, host, port, path, query, fragment}
  • semver parse a semantic version like “1.2.3-beta+5” into {major, minor, patch, pre, build}
  • bump the next version
  • chmod convert Unix file permissions between the number form, like 755, and the letters ls -l shows, like “rwxr-xr-x”
  • ip an IPv4 or IPv6 address as a plain integer, or an integer back as an address
  • cidr facts about an IPv4 block like “10.0.0.0/22”
  • in_cidr whether an IPv4 address is inside a block like “10.0.0.0/22”
  • subnets split an IPv4 block into smaller blocks with the given prefix length, so a /22 splits into four /24s
  • ip_kind what an address is for
  • port the service that normally listens on a port number, like “ssh” for 22, or the port for a service name, or nil if unknown
  • uuid_info what kind of UUID this is (its version and variant)
  • color a color in “#rrggbb” form, from a CSS name, “#rgb”, “#rrggbb” or a list [r, g, b]
  • rgb make a color from red, green and blue amounts (0-255), or give one argument to get a color’s three amounts
  • hsl make a color from hue, saturation and lightness, or give one argument to get a color’s three values
  • mix blend two colors, where t is how far to go from a toward b, 0 to 1
  • lighten make a color lighter, keeping its hue
  • darken make a color darker, keeping its hue
  • invert for a color, the opposite color on the color wheel, like white for black
  • grayscale the gray that looks as bright as the color does
  • contrast how readable one color is on the other, as the WCAG contrast ratio from 1 (identical) to 21 (black on white)
  • swatch a block of the color followed by its hex code, to preview it
  • luhn whether a number passes the Luhn check, the check digit on credit cards and phone IMEIs
  • isbn whether an ISBN-10 or ISBN-13 has a valid check digit
  • iban whether an international bank account number (IBAN) passes its check (the whole number mod 97 must be 1)
  • mime the MIME type for a file name or extension, like “image/png”, which is what a web server sends as Content-Type, or nil if unknown
  • xor xor each byte with the key, repeating the key as often as needed An int key is a single byte. Xor-ing again with the same key gives back the original. Between two ints, a xor b is a ^ b An int key is a single byte. Xor-ing again with the same key gives back the original
  • cyclic_find how many bytes into the cyclic pattern sub appears, or nil
  • drill_bit the diameter of a drill bit written as a number like “#7”, a letter like “F” or a fraction of an inch like “1/4”, in mm
  • tap_drill the drill bit to use before cutting a metric thread like “M6”, as a diameter in mm
  • brainfuck run a Brainfuck program and return what it prints
  • ook run an Ook! program, Brainfuck written with the words Ook. Ook? and Ook!, and return what it prints
  • binary read a compiled program or library (ELF, PE or Mach-O) into a map of what it is, what’s inside it and which security protections it was built with
  • asm assemble x86 or x64 instructions in Intel syntax into machine code, the reverse of disasm
  • demangle turn a compiler-mangled symbol name back into the Rust or C++ name it came from, like c++filt
  • magic what kind of file this is, from the signature bytes it starts with, like the file command
  • png_chunks the chunks of a PNG file as a table of offset, type, length, data, crc and crc_ok
  • exif the EXIF metadata of a JPEG, PNG or TIFF file as a map, like the camera, the time a photo was taken and where
  • pcap the packets in a pcap or pcapng capture, as Wireshark and tcpdump save them, as a table of time, src, dst, proto, sport, dport, len and payload
  • flask_session decode a Flask session cookie into {payload, time, signature}, without checking the signature
  • php_unserialize read PHP’s serialize() format into zil values
  • clipart a piece of clip art from the built-in gallery by name, or with no name, the list of names
  • rainbow color text with a rainbow running diagonally across it
  • gradient color text with a fade from one color on the left to another on the right
  • qr a QR code for the text that phones can scan off the screen
  • segments big digits like a digital clock’s, for 0-9, A-F, -, ., : and spaces
  • img draw an image, from its path or its bytes, width characters wide (the terminal’s width without one, or 80)
  • lsb the low bits of an image’s pixels as bytes, the usual way to hide a message in a picture
  • bit_plane one bit of one color channel of an image as a black and white PNG, white where the bit is set
  • boxed draw a box around text
  • say a clip art picture saying s in a speech bubble: the cow, or any clipart() name
  • cowsay the same as say, named after the classic Unix program
  • think like say, but in a thought bubble
  • beside put picture b to the right of picture a, tops lined up, with gap spaces between
  • stack put picture b under picture a, lined up “left”, “center” or “right”
  • overlay draw picture b on top of picture a, with b’s top-left corner at column x and row y of a (counting from 0)
  • mirror flip a picture left to right (“h”) or upside down (“v”)
  • rotate turn a picture clockwise by 90, 180 or 270 degrees
  • scale make a picture n times bigger by repeating each character n times across and n times down
  • negative swap ink and background: spaces become solid blocks and the other way round, and braille dots are inverted
  • trim_art remove blank lines at the top and bottom, indentation every line shares, and spaces at the ends of lines
  • lsystem grow and draw an L-system
  • fractal draw a well-known fractal by name
  • life run Conway’s Game of Life for steps generations and draw the live cells
  • chess draw a chess board from FEN, the standard text notation for a position
  • card draw a playing card, written as its rank and suit like “A♠”, “10h” or “qd”
  • banner write s in big letters

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.