This commit is contained in:
DavidOnTop 2025-02-25 09:15:39 +01:00
parent da1117ea3e
commit a26c86e2ac
Signed by: DavidOnTop
GPG key ID: 8D3E9A75E3E13D89
3 changed files with 40 additions and 4 deletions

9
hobit.txt Normal file
View file

@ -0,0 +1,9 @@
Zil raz v podzemnej diere isty hobit.
Nebola to odporna, blatista, mokra diera
plna podochnutych cervikov a slizkeho pachu,
ani sucha, hola, piescita diera,
kde si clovek nema kde sadnut
a do coho hryznut.
Bola to hobitia diera, a to znamena
pohodlie.
KONIEC

30
ulohyfs/src/u28.fs Normal file
View file

@ -0,0 +1,30 @@
module UlohyFs.u28
open System.IO
open System.Text.RegularExpressions
open System.Text.Unicode
open UlohyFs.Attributes
open System
let (./.) l r = $"{l}{Path.PathSeparator}{r}"
let getHobit =
Environment.GetFolderPath(Environment.SpecialFolder.Desktop) ./. "maturita" ./. "ZADANIE č.19" ./. "hobit.txt"
|> fun x -> if File.Exists x then Some(x) else None
|> function
| Some(v) -> File.ReadAllText v
| None ->
printfn "Nepodarilo sa najst hobit.txt zadaj cestu k hobit.txt"
let inp = Console.ReadLine()
File.ReadAllText inp
[<Uloha(28)>]
let uloha28() =
let h = getHobit
let mutable spaces = 0
h
|> String.iter (fun c -> if c = ' ' then spaces <- spaces + 1)
printfn "medzery: %d" spaces
h
|> printfn "%s"

View file

@ -6,10 +6,6 @@
<RootNamespace>UlohyFs</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SDL3.Core" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="src\Attributes.fs" />
<Compile Include="src\u16.fs" />
@ -20,6 +16,7 @@
<Compile Include="src\u25.fs" />
<Compile Include="src\u26.fs" />
<Compile Include="src\u27.fs" />
<Compile Include="src\u28.fs" />
<Compile Include="src\u17.fs" />
<Compile Include="src\u18.fs" />
<Compile Include="src\u19.fs" />