I want to check if a line contains a specific word, so I tried to use the String.isSubstring function with the line and the specific word. But somehow that function dosn't work for me.

String.isSubstring("Hi my name is...", "name"); stdIn:2.1-2.47 Error: operator and operand don't agree [tycon mismatch] operator domain: string operand: string * string in expression: String.isSubstring ("Hi my name is...","name") -

I will love if some one can tell me what did i do wrong? Thanx

有帮助吗?

解决方案

String.isSubstring is a curried function -- that is, its arguments are passed in separately, not as a tuple.

Try

String.isSubstring "Hi my name is..." "name"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top