-
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathUpper.fs
More file actions
21 lines (20 loc) · 752 Bytes
/
Upper.fs
File metadata and controls
21 lines (20 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace Algorithms.Strings
module Upper =
/// <summary>
/// Will convert the entire string to uppercase letters
/// </summary>
/// <param name="input">String to change to uppercase.</param>
/// <returns>Uppercased string</returns>
let upper (input: string) =
input.Split()
|> Array.map
(fun word ->
word.ToCharArray()
|> Array.map
(fun character ->
if character >= 'a' && character <= 'z' then
char (int character - 32)
else
character)
|> (fun characters -> System.String.Concat(characters)))
|> String.concat " "