
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

170 Views
Since String class is immutable once created we cannot modify the data of the string. But still, if you want to manipulate string data you can rely on StringBuffer or StringBuilder classes.Examplepublic class Test { public static void main(String args[]) { String str = "Hi welcome "; StringBuffer sb= new StringBuffer(str); sb.append("to Tutorialspoint"); System.out.println(sb); } }OutputHi welcome to Tutorialspoint

5K+ Views
You can reverse the contents of a given String using leaving the spaces using the reverse() method of the StringBuffer class.Examplepublic class Test { public static void main(String args[]) { String str = "hi welcome to Tutorialspoint"; String strArray[] = str.split(" "); StringBuffer sb= new StringBuffer(str); sb.reverse(); for(int i=0 ; i

293 Views
The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. Strings are constant, their values cannot be changed after they are created. To learn more about Strings visit Tutorialspoint Strings page.

2K+ Views
The StringBuffer class contains a method known as deleteCharAt(). This method deletes the character at a specified index/position. You can use this method to delete/remove a particular character from a string in Java.Examplepublic class Test { public static void main(String args[]){ String str = "hi welcome to Tutorialspoint"; StringBuffer sb= new StringBuffer(str); sb.deleteCharAt(sb.length()-1); System.out.println(sb); } }Outputhi welcome to Tutorialspoint

17K+ Views
Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects.The Java platform provides the String class to create and manipulate strings.The most direct way to create a string is to write −String greeting = "Hello world!";Whenever it encounters a string literal in your code, the compiler creates a String object with its value in this case, "Hello world!'.ExampleLive Demopublic class StringDemo { public static void main(String args[]) { char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.' }; String helloString ... Read More

387 Views
The keys() method of Python dictionary class returns a view object consisting of keys used in the dictionary.>>> d1 = {'name': 'Ravi', 'age': 21, 'marks': 60, 'course': 'Computer Engg'} >>>d1.keys() dict_keys(['name', 'age', 'marks', 'course'])It can be stored as a list object. If new key-value pair is added, the view object is automatically updated.>>> l1=d1.keys() >>> l1 dict_keys(['name', 'age', 'marks', 'course']) >>>d1.update({"college":"IITB"}) >>> l1 dict_keys(['name', 'age', 'marks', 'course', 'college'])

507 Views
The update method is one of the methods of the dictionary data structure. It is used to update the values in the already created dictionary, which means it adds a new key-value pair to the dictionary. The updated key and value will be updated at the last. Python update() Method in Dictionary The dictionary is represented by curly braces{}. The dictionary contains key and value pairs, collectively called items, which can accept any data type of elements as values. It is mutable, which means once the dictionary is created, we can apply the changes. It has key-value pairs separated by ... Read More

1K+ Views
Multidimensional Dictionaries in python Multidimensional dictionaries are part of the dictionaries in Python, which are used to store data. Created by assigning a dictionary to a key within another dictionary, these structures are represented by curly braces {} and can accommodate any data type. Their mutable nature allows modifications after creation. They are composed of unique key-value pairs, separated by a colon (:). While keys are unique, values can be duplicated. Accessing values requires using keys, as dictionaries do not support indexing. To retrieve specific key values, use the key combined with indexing. Syntax The following is the syntax for ... Read More

216 Views
The XML is the markup language used to transfer the data. The XML syntax is the same as the HTML, whereas the tags are predefined in HTML and not in XML. This offers us to store the data between the opening and closing tags. In Python, dictionaries store data as key-value pairs. We can serialize a dictionary to XML format using two popular libraries: dict2xml (widely used) dicttoxml ... Read More

636 Views
Double Quotes in PythonDouble quotes are used to represent a string or a character. The functionality of the single quotes and double quotes is the same. We can use any type of quote as per our requirement. The following is the syntax to create a string using double quotes in the Python programming language. str = “text” Example Let’s see an example to understand the functionality and usage of the double quotes in Python. Initially, we have created a string by passing the sentence in double quotes and assigned it to the variable str. Next we printed ... Read More