Find first occurance of a number in a string.
In my class i've been having to use while() and if() statements to display different things from a given string.
Now i have to display the first occurrence of a number in this string. I know how to display all of the numbers and stuff in a string like:
Code:
/*Finds the numbers in the string and displays them*/
while (o < len)
{
if(isdigit(str[o]))
{
printf("%c", str[o]);
}
o++;
}
How do i just display the first number in the string i haven't ever had to do it before. Any tips is greatly appreciated.
If it makes it easier, lets just say the string is: aevf4l68js5bb (the only reason the letters are so random is because the given string is way more confusing)