+ 1

How to cut last numeral in string?( C# or C++)

I should take last numeral Example : "12*8+4" ---- "4" "475/8-89" ---- "89" "34+6-8×42" --- "42" "71×5-800/100" --- "100" Please help me

12th Mar 2021, 3:53 AM
Azimjon Abdug'afforov
Azimjon Abdug'afforov - avatar
6 Réponses
+ 3
From iterating reversal through string in loop, if character is not a number then stop loop and save index value. Now just copy original string up to the founded index value.. There may be other ways you can try..
12th Mar 2021, 12:22 PM
Jayakrishna 🇮🇳
+ 3
You're using extended ASCII character '×' as multiplication operator represeentation. During an attempt I found that it may add to the challenge more difficulty of finding last position of that character in a string (in C# code)
12th Mar 2021, 10:06 PM
Ipang
+ 2
Thanks a lot
13th Mar 2021, 2:47 PM
Azimjon Abdug'afforov
Azimjon Abdug'afforov - avatar
+ 2
Azimjon Abdug'afforov How is it going? Have you solved this yet?
15th Mar 2021, 3:13 AM
Ipang
+ 1
idk about C, but in python i would probably use a while loop and index slicing. like this... https://code.sololearn.com/cr2sWrN3nAHp/?ref=app
12th Mar 2021, 4:36 AM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
listen to Jayakrishna, i just did it but he explained it well.
12th Mar 2021, 2:04 PM
Wilbur Jaywright
Wilbur Jaywright - avatar