NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


import java.util.Arrays;
import java.util.Locale;

public class StringSinifiOrnekleri
{
public static void main(String[] args)
{
String ad = "Emir";
ad += " Civaş";

System.out.println("STR Uzunluk : "+ad.length());
System.out.println("Büyük Harf : "+ad.toUpperCase());
System.out.println("Küçük Harf : "+ad.toLowerCase());

// String Uzunluğu N İse
// İlk Karakter İndexi 0, Son Karakter İndexi N-1
System.out.println("Adın 2. Karakteri : "+ad.charAt(2));

// String'i Char[]'e Çevirmek
char[] harfler = ad.toCharArray();
System.out.println("Harfler : "+Arrays.toString(harfler));

// String Bos Mu
boolean strBosMu = ad.isEmpty();

// String değeri, Diğer String'e Eşit Mi
String str2 = "emir civaş";
// B/K Harf Duyarlılığı Olmadan String Kıyaslama
if (ad.equalsIgnoreCase(str2))
{
System.out.println("B/K Olmadan Stringler Eşit");
}

// Yol 2 # -> 2 Stringide Küçük Harfe Çek Öyle Kıyasla
if ( ad.toLowerCase().equals( str2.toLowerCase() ))
{

}

if (ad.equals(str2))
{
System.out.println("Stringler Eşit");
}
if (!ad.equals(str2))
{
System.out.println("Stringler Farklı");
}

// a.contains(b) --> Icinde Geciyor Mu
// a.startsWith(b) --> a, b ile başlıyor mu
// a.endsWith(b) --> a, b ile bitiyor mu
boolean varMi1 = "Araba".contains("ab"); // true
boolean varMi2 = "Araba".contains("baca"); // false
boolean basliyorMu1 = "Araba".startsWith("Ara"); // true
boolean basliyorMu2 = "Araba".startsWith("ra"); // false
boolean end1 = "Bilgisayar".endsWith("ar"); // true
boolean end2 = "Bilgisayar".endsWith("isay"); // false

// A'nın B'nin Konumu İle İlgili ARama
int baslangic = "Araba".indexOf("ra");
System.out.println("Arabada ra'nın İlk Bulunduğu Yer : "+baslangic);

int sonPos = "arabalar".lastIndexOf("a");
System.out.println("arabalardaki son a : "+sonPos);

// String'in Bir Bölümünü Değiştirme
// Replace Methodu 2 Parametre Alır, 1. Param : Değiştirilmek
// istenen bölüm, 2. Parametre 1. nin yerine ne yazılacağı
String cumle = "Merhaba dunya, nasilsin dunya";
String c2 = cumle.replace("dunya", "mars");
System.out.println(c2);

// Method Chaining (Zincirleme Method Kullanımı)
// toLowerCase, toUpperCase, replace vb.. methodlar
// geriye string'in modifiye edilmiş halini döndürürler
// bu yüzden bir sonraki method, bir önceki methodun sonuna
// nokta ile yazilabilir
String word = "EMR Akademi Java Eğitimleri";
word = word.toUpperCase().replace(" ", "").replace("RA", "AR");
System.out.println("RS : "+word);


// SPLIT : Bir String'i Ayırma
String data = "Merhaba;Nasilsiniz;İyiMisiniz";
String tokens[] = data.split(";"); // {"Merhaba", "Nasilsiniz", "İyiMisiniz" };
System.out.println("TOKEN LENGTH : "+tokens.length);
for (int i = 0; i<tokens.length; i++)
System.out.println("TOKEN "+i+" : "+tokens[i]);

// SUBSTRING : Bir String'i Index'e Göre Parçalama
String ders = "Java Programlama Eğitimi";
String dersAdi = ders.substring(0,4);
System.out.println(dersAdi);
String ne = ders.substring(8);
System.out.println("NE : "+ne);

// TRIM String'in Basinda / Sonundaki Whitespace Karakterleri Temizle
String test = "ntt Hello World tnnn";
System.out.println(test);
System.out.println(test.trim());

}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.