Computer Science Canada

What is the index command?

Author:  Dragoooon [ Sun Mar 23, 2003 5:56 pm ]
Post subject:  What is the index command?

What does the index command do?

Author:  Tony [ Sun Mar 23, 2003 6:45 pm ]
Post subject: 

it is used to see if a string in contrained withing another string and if so, returns the position where it starts.

code:

put index("compsci", "sci")

outputs 5 since "sci" starts on 5th character of "compsci"

it also works the other way:
code:

if index("1234567890", "1") not=0 then
put "its a digit"
else
put "its not a digit"
end if

Author:  Dragoooon [ Sun Mar 23, 2003 6:55 pm ]
Post subject:  thx

thank you :)

Author:  al.ba [ Wed Nov 22, 2017 8:54 pm ]
Post subject:  RE:What is the index command?

Hi, I'm finding difficulties with a turing programming exercises on string manipulation it asks me to gather a word from the user and display it with every vowel exchanged with 9

Author:  kohul [ Wed Apr 04, 2018 8:55 pm ]
Post subject:  Re: RE:What is the index command?

al.ba @ Wed Nov 22, 2017 8:54 pm wrote:
Hi, I'm finding difficulties with a turing programming exercises on string manipulation it asks me to gather a word from the user and display it with every vowel exchanged with 9


Mod edit: deleted answer. OP came here to learn, not to cheat.

that should be it.


: