We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge 5 - Count words and lines
#2
I currently not on pc but I will help.
1) load file using file = file.readlines
2) use text.split for the lines ex: countlines = text.split(file,"/n")
3) use text.split for words ex: countwords = text.split(file," ") use space as separator as words will be separated by space
4) get the length of array countlines and countwords and print on text window.

filep = File.ReadContents(filePath)
text = Array.GetItemCount(filep)
TextWindow.WriteLine(text)


For lines
ZS
Reply


Messages In This Thread
Challenge 5 - Count words and lines - by litdev - 09-06-2024, 08:49 AM
RE: Challenge 5 - Count words and lines - by z-s - 09-06-2024, 12:19 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)