Computer Science Canada Error when trying to use the Str.Trim command to count comment lines |
Author: | Danyn [ Sat Dec 14, 2013 9:42 am ] | ||
Post subject: | Error when trying to use the Str.Trim command to count comment lines | ||
What is it you are trying to achieve? I have to make a program that counts how many lines contain the keyword that they're looking for as well as counting the total lines and comment lines What is the problem you are having? I get an error when using the Str.Trim command Describe what you have tried to solve this problem I've tried setting it as a variable and then using the command but I get the same issue Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1.1 |
Author: | DemonWasp [ Sat Dec 14, 2013 10:41 am ] |
Post subject: | RE:Error when trying to use the Str.Trim command to count comment lines |
In the future, you need to specify what kind of error you're getting. In this case, I'm assuming it's "Substring index is greater than length of string", which means that Str.Trim(text) is returning an empty string, with length = 0, so trying to get the character at (1) results in an error. |