Tag: integer
Python: How to convert integer to string (5 Ways)
In this article we will discuss 5 different ways to convert a integer to string in python. Using str() to convert an int to string in python Python provides a function str(object). It accepts an object as an argument and returns a string representation of that object. So, if we pass the an integer as …
Check if String is Integer in Python
This article will discuss different ways to check if a string is an integer or not in Python. Table of contents Check if a string contains an Integer only using Regex Check if String is Integer using str.isnumeric() Check if String is Integer using Exceptional handling Check if String is Integer using str.isdigit() Check if …
How to Concatenate String and Integer in Python?
In this Python tutorial, we will learn how to concatenate strings and integers. Table Of Contents Concatenate strings and integers using str() Concatenate strings and integers using % operator Concatenate strings and integers using format() Concatenate strings and integers using f-strings Concatenate strings and integers within print() statement Summary Concatenate strings and integers using str() …
Select a row of Pandas DataFrame by integer index
In this article, we will discuss multiple ways to select a row (or multiple rows) of pandas DataFrame by integer index. Table of Contents Preparing dataset for solution Select a row of Pandas DataFrame by integer index using iloc[] Select a row of Pandas DataFrame by integer index using loc[] Summary Preparing dataset for solution …
Convert a Hexadecimal String to an Integer in C++
A hexadecimal string contains only hexadecimal digits and an optional “0x” prefix. The article here discusses various ways to convert a hexadecimal string (with the “0x” prefix) to its corresponding integer value (with a note included after each method containing the changes to be made in the code in case of the hexadecimal string not …
Convert an Integer to a Hexadecimal String in C++
A hexadecimal string contains only hexadecimal digits and an optional “0x” prefix. The article here discusses various ways to convert an integer to a hexadecimal string (with the “0x” prefix). The converted string is in lowercase and can be converted to uppercase using toupper() function in C++. Table Of Contents Method 1: Using a For …
Convert Char Array to an integer in C++
This tutorial will discuss about a unique way to convert char array to an integer. In C++, the string.h header file provides a function stoi(). It accepts a character pointer as an argument, and interprets its contents as an integer value. It returns an int value. We can use this function to convert a char …