Found 15 articles tagged with #strings

Advanced string formatting with f-strings in Python

F-strings (formatted string literals), introduced in Python 3.6, are a way to embed expressions inside string literals, using curly braces.

Feb 15, 2024#python#strings

How to capitalize first letter in Swift

Capitalizing first letter of each word, the first letter of a sentence, or all caps lies in the specific style and purpose of text presentation.

Jan 28, 2024#swift#strings

How to add zeros before number in javascript

Adding leading zeros to a number is often necessary in scenarios where the representation of the number needs to have a fixed width or format.

Using string substring() or slice() in JavaScript

The main difference between `substring()` and `slice()` in JavaScript is how they handle negative or out-of-range arguments.

How to reverse a string in JavaScript

You can achieve string reversal using array manipulation methods like split, reverse, and join or through loops and other techniques.

How to perform string interpolation in Python

You can use the % operator, format method, or f-strings to perform string interpolation, which is inserting values into a string in Python.

Dec 08, 2023#python#strings

How to compare two strings in Swift

One of the basic operations in Swift is to compare two strings for equality or order. There are different ways to do that, depending on your needs.

Nov 28, 2023#swift#strings

Capitalize the first letter of a string in JavaScript

JavaScript provides several approaches to achieve this, ranging from basic techniques to more advanced methods involving functions or regular expressions.

How to convert binary to decimal in JavaScript

A binary number is a numeral system with a base of 2. It uses only two symbols, typically 0 and 1, to represent all values.

Compare two strings ignoring case in JavaScript

You can convert both strings to either lower case or upper case, use the localeCompare method of the String object, or regular expressions with the i flag.