What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-09 00:05:13
length vs length() method in java
length() : In String class we have length() method which is used to return the number of characters in string. Ex : String str = “Hello World”; System.out.println(str.length()); Str.length() will return 11 characters including space. leng... Add solution -
C++ 2022-02-02 22:01:36
distinct char string c++
#include<stdio.h> #include<string.h> // function to return the number of unique // characters in str[] int count_unique_char(char* str) { int hash[128] = { 0 }; int i, c = 0; // reading each character of str[] for (i = 0; i < strlen(... Add solution -
Python 2021-11-17 11:32:13
python comments
# this is a comment # Python ignores comments, something = 1 # and you can place them after any line of code """If you don't want to write a comments using hashtags, you can put them in a multi-line comment block. However, if you put hash... Add solution -
Python 2021-10-31 01:35:10
capitalize python
# Python string capitalization string = "this isn't a #Standard Sntence." string.capitalize() # "This isn't a #standard sentence." string.upper() # "THIS ISN'T A #STANDARD SENTENCE." string.lower() # "this isn't a #stand... Add solution -
Python 2021-10-29 07:35:16
str remove except alphabets
#take user input String1 = input('Enter the String :') #initialize empty String String2 = '' for i in String1: #check for alphabets if (ord(i) >= 65 and ord(i) <= 90) or (ord(i) >= 97 and ord(i) <= 122): #concatenate to empty s... Add solution -
Python 2021-10-10 04:48:10
capitalize string python
# Python string capitalization string = "this isn't a #Standard Sntence." string.capitalize() # "This isn't a #standard sentence." string.upper() # "THIS ISN'T A #STANDARD SENTENCE." string.lower() # "this isn't a #stand... Add solution -
Java 2021-10-07 05:42:04
length and length() method in java
length() : In String class we have length() method which is used to return the number of characters in string. Ex : String str = “Hello World”; System.out.println(str.length()); Str.length() will return 11 characters including space. leng... Add solution -
Java 2021-09-21 00:07:02
how to find frequency of each word in string in java
HOW TO COUNT OCCURRENCE OF THE WORDS IN STRING (It can also be solved by using nested for loops...) String str = "I am happy and why not and why are you not happy you should be"; String [] arr = str.split(" "); Map<String, I... Add solution