First uppercase letter in a string ( Iterative and Recursive ) | C # program to find the first uppercase letter using linear search ; Function to find string which has first character of each word . ; Driver function
using System ; class GFG { static char first ( string str ) { for ( int i = 0 ; i < str . Length ; i ++ ) if ( char . IsUpper ( str [ i ] ) ) return str [ i ] ; return '0' ; } public static void Main ( ) { string str = " geeksforGeeKS " ; char res = first ( str ) ; if ( res == '0' ) Console . WriteLine ( " No ▁ uppercase " + " ▁ letter " ) ; else Console . WriteLine ( res ) ; } }