Random beginner-question: too few arguments

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pferft

Hi everyone,

every now and then I stumble over an error-message like the one in this case:

if "," in text.erase():
	print ("comma erased")

error(109,1): Too few arguments for "erase()" call. Expected at least 2.

Whatever I try to put into those (), nothing seems to work. How can I find out what arguments I need in such a case?

:bust_in_silhouette: Reply From: magicalogic

At the top left of the script editor, click “search help” and type the method. A list with all the methods from any class with a method with such a name will appear so just click the relevant one and you will be given a description of what the method does and the arguments it requires.

In case of “erase” there’s a lot coming up - selecting the one under “String” leads to this then:

void erase(position: int, chars: int)
Erases chars characters from the string starting from position.

I guess it’s a good idea to practice search-help a bit indeed…
Thank you!

pferft | 2020-12-01 12:26