- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Java Program to Determine the Unicode Code Point at a given index
In this article, we will understand how to determine the unicode code point at a given index. Each character is represented by a unicode code point. A code point is an integer value that uniquely identifies the given character. Unicode characters can be encoded using different encodings, like UTF-8 or UTF-16.
Below is a demonstration of the same −
Suppose our input is −
Input String: Java Program Index value: 5
The desired output would be −
Unicode Point: 80
Algorithm
Step 1 - START Step 2 - Declare a string value namely input_string and two integer values namely index and result Step 3 - Define the values. Step 4 - Use the function codePointAt() to fetch the code point value. Store the value as result. Step 5 - Display the result Step 6 - Stop
Example 1
Here, we bind all the operations together under the ‘main’ function.
import java.io.*; public class UniCode { public static void main(String[] args){ System.out.println("Required packages have been imported"); String input_string = "Java Program"; System.out.println("\nThe string is defined as: " +input_string); int result = input_string.codePointAt(5); System.out.println("The unicode point at index 5 is : " + result); } }
Output
Required packages have been imported The string is defined as: Java Program The unicode point at index 5 is : 80
Example 2
Here, we encapsulate the operations into functions exhibiting object-oriented programming.
import java.io.*; public class UniCode { static void unicode_value(String input_string, int index){ int result = input_string.codePointAt(index); System.out.println("The unicode point at index " +index +"is : " + result); } public static void main(String[] args) { System.out.println("Required packages have been imported"); String input_string = "Java Program"; System.out.println("\nThe string is defined as: " +input_string); int index = 5; unicode_value(input_string, index); } }
Output
Required packages have been imported The string is defined as: Java Program The unicode point at index 5is : 80
- Related Articles
- Java Program to determine a Character's Unicode Block
- PHP – How to get the Unicode point value of a given character?
- PHP – How to return character by Unicode code point value using mb_chr()?
- Java Program to Replace a Character at a Specific Index
- Java Program To Determine If a Given Matrix is a Sparse Matrix
- Find a Fixed Point (Value equal to index) in a given array in C++ Program
- Java program to multiply given floating point numbers
- How to find the unicode category for a given character in Java?
- Java Program to get a character located at the String's specified index
- Program to find maximum value at a given index in a bounded array in Python
- Query MySQL with unicode char code?
- Golang program to insert a node at the ith index node, when the index is at the mid-index position in the linked list.
- Golang Program to update the ith index node value, when index is at the last index.
- Golang Program to update the ith index node value, when index is at 0 index.
- Python program to determine whether the given number is a Harshad Number

Advertisements