
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

696 Views
Reversing a string means, moving first character to last, second character to second last and so on. In this article we will discuss how to reverse a string in place using C/C++ program. In the "in place" string reversing, we are not allowed take extra memory to store the string while running program. First of all, let's understand our problem statement:We are given a character string as input and we need to find and output the reverse string of the given string. For example: // Input : a character string "This is a string" //Output : Reverse of ... Read More

224 Views
The take() method of the ArrayBlockingQueue class fetch and removes the head of this queue, waiting if necessary until an element becomes available.The syntax is as followspublic E take() throws InterruptedExceptionTo work with ArrayBlockingQueue class, you need to import the following packageimport java.util.concurrent.ArrayBlockingQueue;The following is an example to implement take() method of Java ArrayBlockingQueue classExample Live Demoimport java.util.concurrent.ArrayBlockingQueue; public class Demo { public static void main(String[] args) throws InterruptedException { ArrayBlockingQueue q = new ArrayBlockingQueue(10); q.add(200); q.add(310); q.add(400); q.add(450); q.add(500); ... Read More

912 Views
Alpha-numeric string are the strings that containing both alphabets and numbers mixed together. These are generally used in security system for generating passwords or hash keys. In this article, we will learn all the approaches for developing a C++ program to generate random alpha numeric stiring. First of all, let's understand the problem statement, We have to input a positive integer for the length of string. The program should output a string of the size containing random characters and numbers. For example, // Input Number : Length of alpha-numeric string 5 // Output String : Alpha-numeric string fd23j ... Read More

495 Views
If you have IntStream with ASCII values, then easily convert it to string using the below given example.For IntStream class, import the following packageimport java.util.stream.IntStream;Let’s say the following is our IntStreamIntStream stream = "Example".chars();Now, convert the IntStream to stringString str = stream.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString();The following is an example to convert IntStream to String in JavaExampleimport java.util.stream.IntStream; class Demo { public static void main(String[] args) { IntStream stream = "Example".chars(); System.out.println("The ASCII values..."); String str = stream.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString(); System.out.println("The ... Read More

7K+ Views
In this article, we will discuss how to extract all the integers from a string using C++ program. We will explore all the possible approaches to do so. First of all, let's understand the problem statement. We have a string that contains a mix of digits and non-digits. We need to extract all the integers from the string and store them in a vector. The integers can be positive or negative. For example, // Input String string str = "ab24wj-123fow" // Output Vector vector vec = {24, -123} Approaches to Extract Integers from String ... Read More

100 Views
The sorted() method of the DoubleStream class returns a stream consisting of the elements of this stream in sorted order.The syntax is as followsDoubleStream sorted()To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;Create a DoubleStream and add some elements to the streamDoubleStream doubleStream = DoubleStream.of(78.9, 90.4, 27.9, 20.6, 45.3, 18.5);Now, sort the elements of the streamdoubleStream.sorted().The following is an example to implement DoubleStream sorted() method in JavaExample Live Demoimport java.util.*; import java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.of(78.9, 90.4, 27.9, 20.6, 45.3, 18.5); ... Read More

858 Views
In this article, we will see how to convert a string to a number and a number to string using modern C++ techniques. Understanding Strings and Numbers In C++, strings and numbers are two different data types. A string is a sequence of characters enclosed in double quotes, and a number can be any numerical value such as integer, float, double, etc. Strings are used to represent text data and numbers are used for mathematical calculations. Let's see an example of defining a string and number. // Define a string string str = "Hello World"; // Define ... Read More

1K+ Views
In this article, we will learn the Collectors.toCollection() method in Java, an essential tool for collecting elements into a specific type of collection, such as a List, Set, or any other collection type. Java 8 introduced a new, powerful feature called Streams, which enables functional-style programming to process sequences of elements. One of the key utilities in the Streams API is the Collectors class. What is the Collectors.toCollection() Method? The Collectors.toCollection() method is a static method in the Collectors class that allows you to collect elements from a stream into a custom collection. public static Collector toCollection(Supplier collectionFactory) Here ... Read More

397 Views
There are several inbuilt functions and objects to convert a number string to an integer in C++. Every method has its own advantages and disadvantages. In this article, we will discuss all the approaches to convert a number string to an integer in C++ with example code and use cases. Number String to Integer Conversion Here is the list of approaches to convert a number string to an integer in C++, which we will be discussing in this article with stepwise explanation and complete example codes. Convert Using stoi() Function ... Read More

22K+ Views
Hexadecimal is a base 16 numbering system that uses 16 digits (from 0 to 9, and then A to F) to represent numbers. It is commonly used in computing systems to represent and store data. In this article, we will learn how to convert a normal integer to a hexadecimal string using C++ program. Integer to Hex String Conversion Here is a list of approaches for converting an integer to a hexadecimal, which we will be discussing in this article with stepwise explanation and complete example codes. Using std::stringstream ... Read More