
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

3K+ Views
In Swift, there are many comparison operators to perform calculations and check different conditions. Less than or greater than operators are used to checking conditional statements. In this article, let's see how to use them with switch and if statements. Less Than or Greater Than the Switch Statement In Swift, you can use the case ..< and case ... syntax to define ranges in a switch statement. The case ..< syntax is used to define a range that includes all values greater than or equal to the first value and less than the second value Step 1 − If ... Read More

280 Views
In C#, LINQ (Language Integrated Query) is a powerful feature that allows us to perform queries on various data sources, including arrays, lists, and databases. It is an efficient and concise way to manipulate data and has become an essential tool for developers. In this article, we will explore how to use LINQ to reverse a list of cities in C#. Before we dive into the code, let us first understand what LINQ is. LINQ is a set of extensions to the .NET Framework that provides a standard way to query data from different data sources using a common syntax. ... Read More

8K+ Views
In programming, there are many situations where we need to reverse a string. One of the most common ways to do this is by using the Reverse() method. However, there are situations where we cannot use this method, and we have to reverse the string using other techniques. In this article, we will explore how to reverse a string in C# without using the Reverse() method. Before we dive into the code, let us first understand what a string is. A string is a sequence of characters that represents text. In C#, a string is a sequence of Unicode characters. ... Read More

1K+ Views
C# is a popular object-oriented programming language used to develop Windows applications, web applications, and games. In this article, we will discuss how to write a C# program to read a string and find the sum of all digits present in the string. Step 1: Reading the Input String The first step in this program is to read the input string from the user. We can use the Console.ReadLine() method to read the string from the console. Here is an example − Console.WriteLine("Enter a string:"); string inputString = Console.ReadLine(); Step 2: Finding the Sum of Digits The next step ... Read More

147 Views
In Swift, you can conform to the CustomStringConvertible protocol to provide a default name for each case in an enumeration. This protocol can be used to provide custom meaning as per the requirement. CustomStringConvertible CustomStringConvertible is a protocol in Swift that defines a single property, description, which returns a String representation of an instance of a conforming type. By conforming to CustomStringConvertible, you can customize how your types are represented as strings when they are printed, logged, or otherwise converted to a string. When you conform to CustomStringConvertible, you define how instances of your type are represented as strings by ... Read More

2K+ Views
In Swift, there are several approaches to removing the leading spaces from a string. There are some methods available like trimmingCharacters, drop, etc. You can also use the NSRegularExpression class to trim all leading spaces from a string. Using the trimmingCharacters() Method The trimmingCharacters(in:) method is a built-in method in Swift's String class that allows you to remove leading and/or trailing characters from a string. The method takes a single argument, which is a CharacterSet object that defines the set of characters to remove. You can create a CharacterSet object using the static properties of the CharacterSet class, such as ... Read More

7K+ Views
C# is a powerful object-oriented programming language used for developing a wide range of applications. In this article, we will discuss how to write a C# program to read and write a byte array to a file using the FileStream class. Step 1: Creating a Byte Array The first step in this program is to create a byte array that we want to write to a file. Here is an example − byte[] byteArray = { 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64 }; Step 2: Writing Byte Array to File The next step is ... Read More

2K+ Views
In Swift, you can use higher-order functions to flatten an array of arrays. You can use a combination of joined(), reduce(), and flatMap() functions. Sometimes, you are required to merge multiple arrays into a single array. In Swift, you can easily do that using high-order functions. In this article, we will see some examples of different use cases. Example 1: Using the flatMap() Function To flatten an array of arrays in Swift, you can use the joined() method along with the flatMap() function. Here's an example. import Foundation let arrayOfArrays = [[1, 2], [3, 4], [5, 6, 7]] let flattenedArray ... Read More

228 Views
Error management in Swift is a technique for dealing with mistakes that happen while the code is running. It enables you to create code that smoothly predicts and deals with mistakes rather than crashing during execution. You will see some examples of how to deal with Swift code errors in this post. The try, catch, and throw keywords are just a few of the error-handling tools offered by Swift. Together, these keywords make it possible for programmers to create error-free code. There are Some Points of How Error Handling Works in Swift If a function can throw an error ... Read More

994 Views
In Swift, you can use the data(using:) method to convert a string to data. This method belongs to the string class and is used to retrieve a data value. In this article, you will see some examples of use cases of this approach. Here are the Steps for Converting NSString to NSData in Swift Create an NSString object containing the string you want to convert. Call the data(using:) method on the NSString object, passing the desired encoding as a parameter. Check if the result of the data(using:) method is not nil by using optional binding (if let). Use the ... Read More