Click here to Skip to main content
15,911,530 members

Comments by HishamMohammedA (Top 12 by date)

HishamMohammedA 21-Oct-20 13:30pm View    
I tired regex but you are right I must know the part that I have to handle it, so maybe I will ask the user to put a mark or something before the part I want to take to make it easier since the string will change each time.
Thank you Richard for helping me.
HishamMohammedA 21-Oct-20 12:21pm View    
sorry for separating the two comments but it refuses to put the full string.
In indexOf, I can put the letter "c" and it will cut what comes after but as you can see in this case I already know the example but what if cout is changed then I can't rely on the letter "c" so I want to use if condition regex so it will cut what comes after it and save it in a new string
HishamMohammedA 21-Oct-20 12:18pm View    
for example, if I have a String like this, String str ="if(i=1)cout<
HishamMohammedA 21-Oct-20 12:09pm View    
Thank you for your replay @Richard, but my main issue is that as I mention my text will be different each time and I am only looking for the text that I want to extract by using regex as a parameter but I believe the indexOf can't receive regex as a parameter.
HishamMohammedA 21-Oct-20 9:14am View    
I knew how to use IndexOf to find the index number of the text, but in that case, how do I save it the text that I extracted in another String?