Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Resolved Issue [Program]: Write a F# program to convert string to vow…
Browse files Browse the repository at this point in the history
…elcase #3593 (#4803)

Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
Co-authored-by: Baliram Singh <heyome9a@gmail.com>
  • Loading branch information
3 people committed Dec 1, 2023
1 parent a4b909d commit 8ebed0e
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let convertToVowelCase (inputString: string) =
let vowels = "aeiouAEIOU"

let isVowel (c: char) = vowels.Contains(c)

let applyVowelCase (c: char) =
if isVowel c then System.Char.ToUpper(c) else System.Char.ToLower(c)

let result = inputString.ToCharArray() |> Array.map applyVowelCase |> System.String

result

// Example usage:
let input = "hello world"
let output = convertToVowelCase input
printfn "Input: %s\nOutput: %s" input output

0 comments on commit 8ebed0e

Please sign in to comment.