Strings functions
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
@Java_Codes_Pro #share #support
1.
length(): Returns the length of a string.2.
toUpperCase(): Converts a string to uppercase.3.
toLowerCase(): Converts a string to lowercase.4.
charAt(index): Returns the character at the specified index of a string.5.
indexOf(searchValue): Returns the index of the first occurrence of a specified value in a string.6.
lastIndexOf(searchValue): Returns the index of the last occurrence of a specified value in a string.7.
substring(startIndex): Returns a substring from a string, starting from the specified index to the end of the string.8.
substring(startIndex, endIndex): Returns a substring from a string, between the specified start and end indexes.9.
replace(oldValue, newValue): Replaces occurrences of a specified value with another value in a string.10.
split(separator): Splits a string into an array of substrings based on the specified separator.11.
trim(): Removes leading and trailing whitespace from a string.12.
startsWith(prefix): Returns true if a string starts with the specified prefix; otherwise, returns false.13.
endsWith(suffix): Returns true if a string ends with the specified suffix; otherwise, returns false.14.
contains(searchValue): Returns true if a string contains the specified value; otherwise, returns false.15.
equals(anotherString): Compares two strings for equality.16.
equalsIgnoreCase(anotherString): Compares two strings for equality, ignoring case differences.@Java_Codes_Pro #share #support
👍7🥰1
public class Main {
public static void main(String[] args) {
String message = new String(new int[] {32, 72, 97, 112, 112, 121, 32, 73, 110, 100, 101, 112, 101, 110, 100, 101, 110, 99, 101, 32, 100, 97, 121, 33}, 0, 24);
System.out.println(message);
}
}
// @java_Codes_pro
public static void main(String[] args) {
String message = new String(new int[] {32, 72, 97, 112, 112, 121, 32, 73, 110, 100, 101, 112, 101, 110, 100, 101, 110, 99, 101, 32, 100, 97, 121, 33}, 0, 24);
System.out.println(message);
}
}
// @java_Codes_pro
Java Codes Basic to Advance pinned «Strings functions 1. length(): Returns the length of a string. 2. toUpperCase(): Converts a string to uppercase. 3. toLowerCase(): Converts a string to lowercase. 4. charAt(index): Returns the character at the specified index of a string. 5. indexOf(searchValue):…»
Notes 📝 :
Telegram.me/BCA_Sem1_Notes
Telegram.me/BCA_Sem2_Notes
Telegram.me/BCA_Sem3_Notes
Telegram.me/BCA_Sem4_Notes
Telegram.me/BCA_Sem5_Notes
Telegram.me/BCA_Sem6_Notes
Code practice Channels:
Telegram.me/C_Codes_pro
Telegram.me/CPP_Codes_pro
Telegram.me/Python_Codes_pro
Telegram.me/Java_Codes_Pro
Telegram.me/Nodejs_Codes_Pro
Info channel:
Telegram.me/Btech_bca_mca
Discussion groups:
Telegram.me/bca_mca_btech
Telegram.me/bca_group_ignou
Learn coding:
Youtube.com/IgnouStudyCenter
Telegram.me/BCA_Sem1_Notes
Telegram.me/BCA_Sem2_Notes
Telegram.me/BCA_Sem3_Notes
Telegram.me/BCA_Sem4_Notes
Telegram.me/BCA_Sem5_Notes
Telegram.me/BCA_Sem6_Notes
Code practice Channels:
Telegram.me/C_Codes_pro
Telegram.me/CPP_Codes_pro
Telegram.me/Python_Codes_pro
Telegram.me/Java_Codes_Pro
Telegram.me/Nodejs_Codes_Pro
Info channel:
Telegram.me/Btech_bca_mca
Discussion groups:
Telegram.me/bca_mca_btech
Telegram.me/bca_group_ignou
Learn coding:
Youtube.com/IgnouStudyCenter
👍2
Java Codes Basic to Advance pinned «Notes 📝 : Telegram.me/BCA_Sem1_Notes Telegram.me/BCA_Sem2_Notes Telegram.me/BCA_Sem3_Notes Telegram.me/BCA_Sem4_Notes Telegram.me/BCA_Sem5_Notes Telegram.me/BCA_Sem6_Notes Code practice Channels: Telegram.me/C_Codes_pro Telegram.me/CPP_Codes_pro Telegram…»
How to run manually without clicking on show button
Click on run button here [in code]
Go to @compiler0bot
Type /start run
You will see code is running there which you clicked here 😉
Click on run button here [in code]
Go to @compiler0bot
Type /start run
You will see code is running there which you clicked here 😉
इस बाॅट में कोड रन करना सीखें।
Learn how to run code in this bot.
@CodeCompiler_Bot
लाभ (Advantage):
आप किसी को भी रियल टाइम में कोड का आउटपुट दिखा सकते हो, जिससे अगर आपके कोड में कोई गलती है तो वह भी सरलता से एक दूसरे से डिस्कस करके साॅल्व कर सकते हो।
See features written in pic ☝️☝️
You can show the output of the code to anyone in real time, so that if there is any mistake in your code, they can easily solve it by discussing with each other.
Full tutorial: https://t.me/logicBots/147
// Atithmetic Operations in Java
public class MyClass {
public static void main(String args[]) {
// declaring variables
int add, sub, div, mul, rem;
// Declaring two varables
int x=4;
int y=2;
// performing Operations
add = x+y; // Addition
sub = x-y; // Subtraction
div = x/y; // Division
mul = x+y; // Multiply
rem= x%y; // reminder
// Showing results
System.out.println("4 + 2 = "+ add);
System.out.println("4 - 2 = "+ sub);
System.out.println("4 * 2 = "+ mul);
System.out.println("4 / 2 = "+ div);
System.out.println("4 % 2 = "+ rem);
}
}👍1
👍1
// Factotial from recursion in java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter Number: " );
int n = s.nextInt();
if(n>26)
System.out.print("Please enter number less than 25\n" );
else{
System.out.println("Showing factorial for "+ n + " Number" );
System.out.print("\n" +Main.f(n));
}
}
// Factorial value calculation + series printing
static long f(long n){
if (n==1){
System.out.print(n);
return n;
}
else{
System.out.print(n + " * ");
return n*f(n-1);
}
}
} // @Java_Codes_Pro
👍4
Ab aap log apna khud ka Compiler bot bana sakte hain easily 🥳🥳🔥
Apne manpasand name aur username se
Create your own
By using @CloneCompiler_bot
See full details: Click Here
Apne manpasand name aur username se
Create your own
By using @CloneCompiler_bot
See full details: Click Here
👍2
// Run and see bharateey flag clolours
public class Main{
public static void main(String[] args){
System.out.println(" Ye Hain\n bharat ke flag\n\"ke colours\"");
}
}You can practice your codes in
@codeCompiler_bot
It supports short coding 👇
For upper part of java you can simply write
And for lower part
Then in middle you can write java code
But one thing more
You don't need to write big print statement like
Just write
And then your code without parenthesis
Full example
You can run this code on @codeCompiler_bot using
/jv command
You can convert this code in real java code by using
/rjv command
Here is more short code example
See practical example 👇
t.me/LogicB_Support/11005
Is it easy give reactions or ask questions 👇
@codeCompiler_bot
It supports short coding 👇
For upper part of java you can simply write
"Start"
And for lower part
"End"
Then in middle you can write java code
But one thing more
You don't need to write big print statement like
System.out.println();
Just write
pt
And then your code without parenthesis
Full example
"Start"
Pt "hi this is mine short java"
"End"
You can run this code on @codeCompiler_bot using
/jv command
You can convert this code in real java code by using
/rjv command
Here is more short code example
import java.util.Scanner;
"Start"
Scanner scanner = new Scanner(System.in);
Pt"Enter an integer: "
int number = scanner.nextInt();
Pt"You entered: " + number
scanner.close();
"End"
See practical example 👇
t.me/LogicB_Support/11005
Is it easy give reactions or ask questions 👇
👍2🥰1
It's discussion group is now public
Join @java_group_pro
Join @java_group_pro
Select your group/channel/service
t.me/Sid_info/69
t.me/Sid_info/69
// 1. length()
public class StringLengthExample {
public static void main(String[] args) {
String str = "Hello, World!";
int length = str.length();
System.out.println("Length of the string: " + length);
}
}👍1
// 2. toUpperCase()
public class UpperCaseExample {
public static void main(String[] args) {
String str = "Hello, World!";
String upperCaseString = str.toUpperCase();
System.out.println("Uppercase string: " + upperCaseString);
}
}