Java Program To Replace Character With It's Occurrence | Java | Ashok IT

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • ✍️✍️ Register Here For Online Training : bit.ly/4dBYJbX
    ** For Online Training ► Call: +91-6301921083
    Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.
    💡 Visit Our Website
    For Online Training: www.ashokit.in
    💡 About Ashok IT :
    Ashok IT is the No.1 quality training institute in India for the candidates who want to build their future in Information Technology. We are into online training, class room training, corporate training and one to one training with more passion and dedication. Ashok IT aims in providing best quality realtime oriented trainings on C, C++, Java, Spring , Spring REST, Spring Cloud, Microservices, Python, DJango, .Net, Angular, React JS, Salesforce, , Testing, Android, Docker, Kubernates, Manual Testing, Selenium and Digital Marketing.
    -----------------------------------------------------------------------------------
    💡 Our Online Training Features
    🎈 Training with Real-time Working Professionals
    🎈 Industry Matching use cases
    🎈 Live Coding
    🎈 Real-time Environment
    🎈 Class Notes
    🎈 Doubts Clarifications in Each Session
    -----------------------------------------------------------------------------------
    💡 Contact details:
    ☎ WhatsApp Number: +91-6301921083
    ► Website : www.ashokit.in
    ► Join with us in Telegram : bit.ly/3iP2KyA
    ► Like us in Facebook : bit.ly/3dw6R0A
    ► Follow us in Instagram : bit.ly/3jzEKl8
    ► Follow us in Twitter : bit.ly/2SDqdK4

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

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

    🔥 Welcome to Ashok IT..!!
    👉 Register Here For Online Training : bit.ly/4dBYJbX
    👉 Follow us in Instagram : bit.ly/3jzEKl8
    👉 Follow Us in WhatsApp : bit.ly/49wCWje
    👉 Visit Our Website : ashokit.in/

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

    for(int i = 0 ; i

  • @YashSingh-xs5yj
    @YashSingh-xs5yj หลายเดือนก่อน +1

    Sir, it was a great tutorial can you please help, one interview coding question which was based on String I was not able to solve that properly
    Input: abbcccdddd
    Output: ab2c3d4
    If the repetition of a char in a string is more than one, then it should be replaced by a number denoting the occurrence of that char in String

    • @ashokit
      @ashokit  12 วันที่ผ่านมา +1

      🔥 Please follow us in WhatsApp channel : bit.ly/49wCWje

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

    Nice. Kindly give data structure video also

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

    9:05 why this will not work, not clear, does it mean it will store only single char of integer like not greater than 0-9 ?

  • @YashSingh-xs5yj
    @YashSingh-xs5yj หลายเดือนก่อน +1

    package StringQuestions;
    public class ReplaceCharWithCountOfRepetition {
    public static void main(String[] args) {
    String input = "opentext";
    char chCheck = 't';
    input = input.toLowerCase();
    if (input.indexOf(chCheck) == -1) {
    System.out.println("The Given Character is not present!");
    return; // Exit early if the character is not found
    }
    StringBuilder sb = new StringBuilder(input);
    int count = 1;
    for (int i = 0; i < sb.length(); i++) {
    if (sb.charAt(i) == chCheck) {
    sb.setCharAt(i, (char) ('0' + count));
    count++;
    }
    }
    System.out.println(sb.toString());
    }
    }

    • @ashokit
      @ashokit  12 วันที่ผ่านมา

      Please contact our admin team : 9985396677

  • @beastcombatanalysing635
    @beastcombatanalysing635 6 หลายเดือนก่อน

    What would happen if we just did it as arr[i] = String.valueOf(cnt); ?

    • @ashokit
      @ashokit  2 หลายเดือนก่อน

      please contact our admin team : +91 9985396677

  • @sainath2983
    @sainath2983 5 หลายเดือนก่อน

    string str = "opentext";
    char ch = 't';
    int count = 48;
    char[] chars = str.ToCharArray();
    for (int i = 0; i < chars.Length; i++)
    {
    if (ch == chars[i])
    {
    count++;
    chars[i] = (char)count;
    }
    }
    Console.WriteLine(chars);

    • @ashokit
      @ashokit  12 วันที่ผ่านมา

      🔥 Please follow us in WhatsApp channel : bit.ly/49wCWje

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

    Why are we using charAt(0)..plz explain

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

      simple because charAt(0) return the first character in the string

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

      Because we want to put at arr[i] in 0th index

    • @sonamSharma15
      @sonamSharma15 2 หลายเดือนก่อน

      Please explain

  • @umadevialamkonda8860
    @umadevialamkonda8860 12 วันที่ผ่านมา

    public static String Replace_occurances(String s,char rc) {

    StringBuilder ans= new StringBuilder();
    int count=1;
    if(s.indexOf(rc)==-1){
    System.out.println("The given character "+rc+" is not present in the String");
    }else{
    for(int i=0;i

    • @ashokit
      @ashokit  11 วันที่ผ่านมา

      🔥 Please follow us in WhatsApp channel : bit.ly/49wCWje

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

    How to change only the second occurrence with different character?

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

      Please Contact Our Admin Team:wa.me/+919985396677
      👉 Subscribe To Our TH-cam Channel: bit.ly/41IHJdj