• 27-07-2023, 20:55:12
    #1
    Merhaba arkadaşlar. Android Studio Java ile Kelime Nasıl Bulabilirim acaba?

    Örneğin şöyle bir metin var elimde :

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    Bu metnin içinde text ve lorem kelimeleri var mı yok mu diye nasıl bir yol bulabilirim.
    Teşekkürler.
  • 27-07-2023, 21:02:43
    #2
    Ctrlf+ f basın oraya kelimeyi yazın nerde varsa çıkar
  • 27-07-2023, 21:03:48
    #3
    bycida adlı üyeden alıntı: mesajı görüntüle
    Ctrlf+ f basın oraya kelimeyi yazın nerde varsa çıkar
    Öyle değil hocam
    Kodla bulmak istiyorum
  • 27-07-2023, 21:07:49
    #4
    Kolay gelsin,
    edit- detaylı

    String text = "test yazısı, a b c, merhaba";
    
    if(text.contains("merhaba")){
    //merhaba kelimesi, text içinde var
    }
  • 27-07-2023, 21:32:04
    #5
    örnek
    public class MainActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            String metin = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
    
            boolean textVarMi = metin.contains("text");
    
            boolean loremVarMi = metin.contains("lorem");
    
            if (textVarMi) {
                Log.d("MetinKontrol", "Metin içinde 'text' kelimesi bulunuyor.");
            } else {
                Log.d("MetinKontrol", "Metin içinde 'text' kelimesi bulunmuyor.");
            }
    
            if (loremVarMi) {
                Log.d("MetinKontrol", "Metin içinde 'lorem' kelimesi bulunuyor.");
            } else {
                Log.d("MetinKontrol", "Metin içinde 'lorem' kelimesi bulunmuyor.");
            }
        }
    }
    Log sınıfıyla logcat'e yazdırır
  • 27-07-2023, 21:38:45
    #6
    ERTET adlı üyeden alıntı: mesajı görüntüle
    Kolay gelsin,
    edit- detaylı

    String text = "test yazısı, a b c, merhaba";
    
    if(text.contains("merhaba")){
    //merhaba kelimesi, text içinde var
    }
    Cansın hocam çok teşekkür ederim 🙏