Remove White Spaces in a String in Java

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 18

  • @yforyou1342
    @yforyou1342 3 ปีที่แล้ว +2

    Recently I handled this one in my project by using \\S it worked.. Sir can you make a video on how to handle or remove  (no back space)from a string. I handled it but wanted to share with our folks.

  • @sankygupta1
    @sankygupta1 ปีที่แล้ว

    Helpful 👍🏻😊

  • @sivarajan22
    @sivarajan22 3 ปีที่แล้ว

    Thanks you so much Naveen. Can we use string tokenizer for removing the white spaces?

  • @ankushbhardwaj5456
    @ankushbhardwaj5456 3 ปีที่แล้ว +1

    Hi @Naveen what if we need to remove only extra spaces for e.g. string = "This is my new java code." Now between each string only one space is required. How we can achieve result as : "This is my new java code."

    • @naveenautomationlabs
      @naveenautomationlabs  3 ปีที่แล้ว +5

      String t = " This is my new java code";
      System.out.println(t.replaceAll("\\s+", " ").trim());

    • @Ram_5
      @Ram_5 2 ปีที่แล้ว

      @@naveenautomationlabs Hi sir, What ever logic you put,it removes all spaces in a sentance but our question is need one space between words and remove extra spaces in between words in a sentance means, output should be "This is my new java code"..Please provide the answer sir

  • @sureshkassa8949
    @sureshkassa8949 3 ปีที่แล้ว

    One word amazing that's it.

  • @RakesAB
    @RakesAB 3 ปีที่แล้ว

    Hi Naveen.
    I am from electronics manufacturing background and having overall experience in QA. Can I get a job in software testing. And if yes then how.?
    Waiting for your valuable response.

  • @likhithasaladi6348
    @likhithasaladi6348 3 ปีที่แล้ว

    Hi do you have idea on duck creek technologies. If so can you please do video on it

  • @rukmanibabu897
    @rukmanibabu897 3 ปีที่แล้ว

    Thank you sir

  • @gousiyamamadapur6170
    @gousiyamamadapur6170 3 ปีที่แล้ว

    How can I remove space before dot...ex: Hello Java .(I want to remove space before dot...)..may I know sir

  • @atul8784
    @atul8784 3 ปีที่แล้ว

    Thanx sir

  • @chanti.podilapu
    @chanti.podilapu 3 ปีที่แล้ว

    Please do these in python also

  • @jwalakumar9434
    @jwalakumar9434 2 ปีที่แล้ว +1

    String str = " Selenium is awesome ";

    String[] strArry = str.split(" ");
    for(int i = 0; i < strArry.length; i++) {
    System.out.print(strArry[i]);
    }

    • @f.a5148
      @f.a5148 ปีที่แล้ว

      thanks man yours is easier