Use the wordbreak property in JavaScript to set line breaking rules for non-CJK scripts. The following are CJK scripts: C for Chinese, J for Japanese, K for Korean.ExampleYou can try to run the following code to learn how to implement wordbreak property − #box { width: 150px; height: 120px; background-color: lightblue; border: 1px solid black; } Set This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text. function display() { document.getElementById("box").style.wordBreak = "break-all"; }
Protected access specifier allows a child class to access the member variables and member functions of its base class. This way it helps in implementing inheritance. We will discuss this in more details in the inheritance chapter.The following is an example showing we have set an protected member variable in Class A.class A { protected int a2 = 87; }Now under the derived class when we will try to access the above variable from the derived class object, then it would work fine as shown below −Exampleusing System; class A { protected int a2 = 87; } class ... Read More
Use the textOverflow property to counter the text overflow issue. Add ellipses if the text overflows the containing element.ExampleYou can try to run the following code to learn what is to be done when text overflows the containing element with JavaScript − #myID { border: 2px solid blue; background-color: gray; overflow: hidden; text-overflow: visible; width: 200px; ... Read More
To set the capitalization, use the textTransform property in JavaScript. Set it to capitalize, if you want the first letter of every word to be a capital letter.ExampleYou can try to run the following code to return the capitalization of a text with JavaScript − Capitalize Text This is demo text! This is demo text! function display() { document.getElementById("myID").style.textTransform = "capitalize"; }
Set the minimum and maximum element to the first element so that you can compare all the elements.For maximum.if(arr[i]>max) { max = arr[i]; }For minimum.if(arr[i]
The HTML DO MouseEvent offsetX property returns the horizontal (x) coordinate of the mouse pointer relative to the target element if a mouse event was triggered. Use with offsetY to get the vertical coordinate as well.Following is the syntax −Returning reference to the offsetX objectMouseEventObject.offsetXLet us see an example of MouseEvent offsetX property −Example Live Demo MouseEvent offsetX * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } #outer { width:70%; ... Read More
Use the substring() method in C# to check each and every substring for unique characters. Loop it until the length of the string.If any one the substring matches another, then it would mean that the string do not have unique characters.You can try to run the following code to determine if a string has all unique characters.Example Live Demousing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class Demo { public bool CheckUnique(string str) { string one = ""; string two = ""; for (int i = 0; i ... Read More
The HTML DOM Meter value property returns/sets a number corresponding to the value attribute of a element. Use this with high, low, min and max attributes for better results.NOTE: Don’t use as a progress bar but only as a gauge.Following is the syntax −Returning value of the value propertymeterElementObject.valueValue of the value property setmeterElementObject.value = numberLet us see an example of Meter value property −Example Live Demo Meter value form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; ... Read More
Initialize the array.int[] myArr = new int[5] {98, 76, 99, 32, 77};Compare the first element in the array with the next element to find the largest element, then the second largest, etc.if(myArr[i] < myArr[j]) { temp = myArr[i]; myArr[i] = myArr[j]; myArr[j] = temp; }Above, i and j are initially set to.i=0; j=i+1;Try to run the following code to sort an array in descending order.Example Live Demousing System; public class Demo { public static void Main() { int[] myArr = new int[5] {98, 76, 99, 32, 77}; int i, j, temp; Console.Write("Elements: "); for(i=0;i
The "as" operator perform conversions between compatible types. It is like a cast operation and it performs only reference conversions, nullable conversions, and boxing conversions. The as operator can't perform other conversions, such as user-defined conversions, which should instead be performed by using cast expressions.The following is an example showing the usage of as operation in C#. Here as is used for conversion.string s = obj[i] as string;Try to run the following code to work with ‘as’ operator in C#.Example Live Demousing System; public class Demo { public static void Main() { object[] obj = new object[2]; ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP