Computer Science Canada Need help identifying a function |
Author: | KC 40oz [ Tue Nov 15, 2005 10:03 am ] |
Post subject: | Need help identifying a function |
I'm making a binary -> decimal convertor and i need the function that counts the # of digits in a variable and also that can grab single digits i am SURE i learned this last year, but the help file at my school isnt working right now any help would be appreciated |
Author: | ZeroPaladn [ Tue Nov 15, 2005 10:20 am ] |
Post subject: | |
lolz, i did this for extra credit this september, although i didnt know that there was a function for it ![]() http://www.compsci.ca/v2/viewtopic.php?t=9806 |
Author: | Albrecd [ Tue Nov 15, 2005 10:40 am ] | ||
Post subject: | length | ||
Use "length (variable)" Ex:
|
Author: | do_pete [ Tue Nov 15, 2005 11:27 am ] |
Post subject: | |
length(variable) is for strings. So in order to use that you would have to convert the interger into a string using intstr() |
Author: | KC 40oz [ Tue Nov 15, 2005 12:37 pm ] |
Post subject: | |
ok thanks, i also need to be able to extract a certain char from the string, and i remember doing that yet cant remember for the life of me what the function was i remember it including * s to signify the last char in the string |
Author: | do_pete [ Tue Nov 15, 2005 12:49 pm ] | ||||
Post subject: | |||||
i don't know about the *s but you just go something like this
Character is the character you want to isolate. String is the string and number is the number of the character. for example this would print "r" becuase "r" is the third character in the string "turing"
|
Author: | codemage [ Tue Nov 15, 2005 1:09 pm ] |
Post subject: | |
Treat strings like you would arrays of characters. var x : string := "abcdefghijklmn" put x (3) -> puts out "c" put x (5..*-2) - >puts out "efghijkl" You can use index and length for more in-depth string manipulation. |