#1 How to find a particular character in string?? (*The thought process)
Himanshupal0001
Posted on March 10, 2022
The above code snippet might be total utter for the beginners.
I myself struggled a lot while learning code(still struggling '-'). But I've improved myself over the ears(my eyesight was in negative though ngl)... sorry years by copying same code again and again.
Just kidding ...but most of us do right? Copying same thing again and again but still struggling. SO why is that?
What I've learning is that copying code is not bad but not putting thoughts in it is bad.
As you can see the code below
I'm gonna explain my thought process here.
As we are seeing in first line there's a variable str storing string in it.
I want to extract only fullstops (.)(.)...hehe (note* 2 fullstops for plural) . Yea so we only want fullstops from the string.
So what can I do?
First I want to know the ascii code of each character.
So I googled it.
I got the results.
Then I just compare the ascii code to integer value. If matched then print it to console. Oh..... you can use trim function to trim the space.
At the end I just wanna say focus on finding the solution rather then code. You can always google the code for it if you have the solution. Break it in steps. Do things step by step. It will help you in long run. Google code not solution!!!!
Posted on March 10, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.