- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 34494 Articles for Programming
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
189 Views
The constant() function returns the value of a constant.Syntaxconstant(const)Parametersconst − The name of the constant to checkReturnThe constant() function returns the value of a constant and NULL if the constant is not defined.ExampleThe following is an example that defines a constant. Live DemoOutputThe following is the output.This is it!
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
83 Views
The FILTER_CALLBACK constant calls a user defined function to filter the value.ReturnThe FILTER_CALLBACK constant does not return anything.ExampleThe following is an example that converts the case of a string. Here, existing function in PHP is taken. Live DemoOutputThe following is the output.demo text!
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
120 Views
The FILTER_SANITIZE_STRIPPED constant encodes or strips unwanted characters.Options and FlagsFILTER_FLAG_NO_ENCODE_QUOTES − This flag does not encode quotesFILTER_FLAG_STRIP_LOW − Strips characters with ASCII value below 32FILTER_FLAG_STRIP_HIGH − Strips characters with ASCII value above 32FILTER_FLAG_ENCODE_LOW − Encodes characters with ASCII value below 32FILTER_FLAG_ENCODE_HIGH − Encodes characters with ASCII value above 32FILTER_FLAG_ENCODE_AMP − Encodes the & character to &ReturnThe FILTER_SANITIZE_STRIPPED constant does not return anything.Example Live DemoOutputThe following is the output.string(10) "Demo!text!"
![Vikyath Ram](https://www.tutorialspoint.com/assets/profiles/13780/profile/60_74413-1512648006.jpg)
3K+ Views
For swapping characters of a string in Java we can use string builder which is mutable so we need not to take care of new object creation during swapping. In this we would create a method which swap characters of string based on location of swapping characters.This method will take location of swapping characters as its parameters.First store both characters need to be swapped and using set character method of string builder swap the targeted characters. Example Live Demo public class SwapCharacters { public static void main(String[] args) { ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
273 Views
The FILTER_SANITIZE_STRING constant deletes tags and encodes special characters from a string.FlagsFILTER_FLAG_NO_ENCODE_QUOTES − Do not encode quotesFILTER_FLAG_STRIP_LOW − Removes characters with ASCII value less than 32FILTER_FLAG_STRIP_HIGH − Removes characters with ASCII value greater than 127FILTER_FLAG_ENCODE_LOW − Encodes characters with ASCII value less than 32FILTER_FLAG_ENCODE_HIGH − Encodes characters with ASCII value greater than 127FILTER_FLAG_ENCODE_AMP − Encodes the "&" character to &ReturnThe FILTER_SANITIZE_STRING constant does not return anything.Example Live DemoOutputThe following is the output.Demo!
![Jai Janardhan](https://www.tutorialspoint.com/assets/profiles/13513/profile/60_63529-1512538711.jpg)
1K+ Views
In order to swap two variable using single expression or in single line we could use bitwise XOR operator of Java. As we now that in Java XOR functions as XOR of two numbers a and b returns a number which has all the bits as 1 wherever bits of a and b differs. So for swapping of two variable we would use this operator as Example Live Demo public class SwapUsingBitwise { public static void main(String[] args) { int a = 8 ; int b = 10; ... Read More
![Arushi](https://www.tutorialspoint.com/assets/profiles/13510/profile/60_55588-1512537391.jpg)
211 Views
In order to swap two strings i.e interchange the content of two strings we will use sub string method of string class in Java.First of all get the length of both strings before making any change in any of string.Now modify one string as concatenate both strings and assign to one string. After this use sub string method of String class using begin index as length of new modified string 1 and last index as initial length of string 1.This will give us the swiped string 1 which contain content of string 2. Now to get swiped string 2 again ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
531 Views
The FILTER_SANITIZE_SPECIAL_CHARS constant filter HTML-escapes special characters.FlagsFILTER_FLAG_STRIP_LOW − Strip characters with ASCII value below 32FILTER_FLAG_STRIP_HIGH − Strip characters with ASCII value above 32FILTER_FLAG_ENCODE_HIGH − Encode characters with ASCII value above 32ReturnThe FILTER_SANITIZE_SPECIAL_CHARS constant does not anything.Example Live DemoOutputThe following is the output.string(43) "Favorite Sports is Football & Cricket?"
![Fendadis John](https://www.tutorialspoint.com/assets/profiles/13534/profile/60_64028-1512539837.jpg)
1K+ Views
Stream is a new abstract layer introduced in Java 8. Using stream, you can process data in a declarative way similar to SQL statements. For example, consider the following SQL statement. SELECT max(salary), employee_id, employee_name FROM Employee The above SQL expression automatically returns the maximum salaried employee's details, without doing any computation on the developer's end. Using collections framework in Java, a developer has to use loops and make repeated checks. Another concern is efficiency; as multi-core processors are available at ease, a Java developer has to write parallel code processing that can be pretty error-prone. To resolve ... Read More