All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Encrypt and Decrypt a String Using AES CBC in Go

In Golang, using the crypto/aes package is the easiest way to encrypt a string using AES CBC. Ehrsam, Meyer, Smith and Tuchman invented the cipher block chaining (CBC) mode of operation in 1976. In CBC mode, each block of plaintext is XORed with the ...
Tomoki

How to Pad a Numeric String with Zeros to the Left in Python

In Python, there are 3 ways to pad a numeric string with zeros to the left. Using zfill Method The str.zfill(width) method returns a copy of the string left filled with ASCII '0' digits to make a string of length width. For example, #!/usr/bin/...
Patcher56

How to print a formatted string in Rust

Rust String Formatting and Printing Best Practices.Using println! Prints to the standard output, with a newline. Use the format! syntax to write data to the standard output. See std::fmt for more information. fn main() { let name = "Bob"; pri...
aweis

How to convert an int to a string type in Go

3 ways to convert int64 to string in Golang.Using strconv.Itoa Function The code snippet below shows how to convert an int to a string using the Itoa function. package main import ( "fmt" "strconv" ) func main() { s := strconv.Itoa(100) f...
aweis

How to format a string in Python

Python String Formatting Best Practices.Fancier Output Formatting To use formatted string literals, begin a string with f or F before the opening quotation mark or triple quotation mark. Inside this string, you can write a Python expression between {...
Sambhav Khandelwal

How to format a string in PHP

Formatting PHP Strings with printf and sprintf. Using sprintf Function The sprintf() return a formatted string. sprintf(string $format, mixed ...$values): string // iPhone 14 Pro echo sprintf("%s %d Pro\n", "iPhone", 14); // iPhone 14 Pro prin...
Patcher56

How to use fmt.Sprintf Function in Go

Format a string without printing in Go.Basics Package fmt implements formatted I/O with functions analogous to C's printf and scanf. The format 'verbs' are derived from C's but are simpler. fmt.Sprintf Sprintf formats according to a format specif...
Sambhav Khandelwal

How to check if string contains a substring in Go

Go test string contains substring.Using strings.Contains Function How do I check if a string is a substring of another string in Go? Use the function Contains from the strings package. Contains function returns a boolean value. It returns true if the...
Tomoki

How to install Popper

Tooltip & Popover Positioning Engine.Given an element, such as a button, and a tooltip element describing it, --pname-- will automatically put the tooltip in the right place near the button. It will position any UI element that "pops out" from the f...