Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles on Trending Technologies
Technical articles with clear explanations and examples
String slicing in C# to rotate a string
Let’s say our string is −var str = "welcome";Use the substring() method and the following, if you want to rotate only some characters. Here, we are rotating only 2 characters −var res = str.Substring(1, str.Length - 1) + str.Substring(0, 2);The following is the complete code −Exampleusing System; public class Program { public static void Main() { var str = "welcome"; Console.WriteLine("Original String = "+str); var res = str.Substring(1, str.Length - 1) + str.Substring(0, 2); Console.WriteLine("Rotating two characters in the String: "+res); } }OutputOriginal String = welcome Rotating two characters in the String: elcomewe
Read MoreAdd plain text next to a form label within a form with Bootstrap
To add plain text to a form label within a form, use the .form-control-static in Bootstrap.You can try to run the following code to implement a .form-control-static class in BootstrapExample Bootstrap Example Email: amit@demo.com
Read MoreString Formatting in C# to add padding
With C#, you can easily format content and add padding to it.To add padding −const string format = "{0,-5} {1,5}";Now, add the padding to the strings −string str1 = string.Format(format, "Rank","Student"); string str2 = string.Format(format, "2","Tom");Let us see the complete code −Exampleusing System; using System.Collections.Generic; public class Program { public static void Main() { // set padding const string format = "{0,-5} {1,5}"; string str1 = string.Format(format, "Rank","Student"); string str2 = string.Format(format, "2","Tom"); Console.WriteLine(str1); Console.WriteLine(str2); } }OutputRank Student 2 Tom
Read MoreC# Program to filter array elements based on a predicate
Set an array.int[] arr = { 40, 42, 12, 83, 75, 40, 95 };Use the Where clause and predicate to get elements above 50.IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50);Let us see the complete code −Exampleusing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] arr = { 40, 42, 12, 83, 75, 40, 95 }; Console.WriteLine("Array:"); foreach (int a in arr) { Console.WriteLine(a); } // getting elements above 70 IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50); Console.WriteLine("Elements above 50...:"); foreach (int res in myQuery) { Console.WriteLine(res); } } }OutputArray: 40 42 12 83 75 40 95 Elements above 50...: 83 75 95
Read MoreBootstrap .checkbox-inline class
Use .checkbox-inline class to a series of checkboxes for controls to appear on the same line. You can try to run the following code to implement the .checkbox-inline classExample Bootstrap Forms Best IDE (You can select more than one) NetBeans IDE Eclipse IDE
Read MoreContainer for form input and label with Bootstrap
Use the .form-group class in Bootstrap to set a container for form input and label &minusExample Bootstrap Example Student Name Upload Resume Example block-level help text here. Next
Read MoreHow to use #error and #warning directives in C#?
#error directiveThe #error directive allows generating an error from a specific location in your code.Let us see an example −Exampleusing System; namespace Demo { class Program { public static void Main(string[] args) { #if (!ONE) #error ONE is undefined #endif Console.WriteLine("Generating a user-defined error!"); } } }After running the above program, a user-defined error generates −OutputCompilation failed: 1 error(s), 0 warnings error CS1029: #error: 'ONE is undefined'#warning directiveThe #warning directive allows generating a level one ...
Read MoreConvert.ToDecimal Method in C#
Convert a specified value to a decimal number using the Convert.ToDecimal() method.We have a string here.string stringVal = "2,345.26";Now, let us use the Convert.ToDecimal() method to convert it to a decimal number.decimal decimalVal; decimalVal = System.Convert.ToDecimal(stringVal);Let us now see the complete example −Exampleusing System; public class Demo { public static void Main() { decimal decimalVal; string stringVal = "2,345.26"; decimalVal = System.Convert.ToDecimal(stringVal); System.Console.WriteLine("String converted to decimal = {0} ", decimalVal); } }OutputString converted to decimal = 2345.26
Read MoreBootstrap .radio-inline class
Use .radio-inline class to a series of radios for controls to appear on the same line. You can try to run the following code to implement the radio-inline class in Bootstrap −Example Bootstrap Forms Best Porgraming Language Java C C++
Read MoreMake a <form> left-aligned with Bootstrap
Use the .form-inline class in Bootstrap to make a left aligned.You can try to run the following code to implement .form-inline classExample Bootstrap Example Name Name Submit
Read More