07-24-2023, 07:42 AM
I am using the Fiddler web debugger which uses [FiddlerScript][1] which is based on JScript.NET. I'm trying to do some simple .NET string parsing but it fails with error "**More than one method or property matches this argument list**". For example:
var ahraw: String = "one, two, three, four";
var ah: Array = ahraw.Split([',', ' '], System.StringSplitOptions.RemoveEmptyEntries);
for (var i in ah) {
FiddlerObject.alert("\"" + ah[i] + "\"");
}
[![enter image description here][2]][2]
[String.Split][3] has these prototypes:
Split(Char[], Int32, StringSplitOptions)
Split(String[], Int32, StringSplitOptions)
Split(String[], StringSplitOptions)
Split(Char[], StringSplitOptions)
Split(Char[], Int32)
Split(Char[])
Even if I add an Int32 and run it like `ahraw.Split([',', ' '], 99, System.StringSplitOptions.RemoveEmptyEntries);` or `ahraw.Split(", ", 99, System.StringSplitOptions.RemoveEmptyEntries);` it still finds multiple methods. Is it possible to force the specific .NET type? Something like `var sep: String` doesn't work either.
Of course there are other ways to split a string in JScript such as split() (note the lowercase s). I'm more interested in how I can get around this issue for when there's no javascript equivalent for the function I need to call, so I have to call a .NET funciton.
[1]:
[3]:
var ahraw: String = "one, two, three, four";
var ah: Array = ahraw.Split([',', ' '], System.StringSplitOptions.RemoveEmptyEntries);
for (var i in ah) {
FiddlerObject.alert("\"" + ah[i] + "\"");
}
[![enter image description here][2]][2]
[String.Split][3] has these prototypes:
Split(Char[], Int32, StringSplitOptions)
Split(String[], Int32, StringSplitOptions)
Split(String[], StringSplitOptions)
Split(Char[], StringSplitOptions)
Split(Char[], Int32)
Split(Char[])
Even if I add an Int32 and run it like `ahraw.Split([',', ' '], 99, System.StringSplitOptions.RemoveEmptyEntries);` or `ahraw.Split(", ", 99, System.StringSplitOptions.RemoveEmptyEntries);` it still finds multiple methods. Is it possible to force the specific .NET type? Something like `var sep: String` doesn't work either.
Of course there are other ways to split a string in JScript such as split() (note the lowercase s). I'm more interested in how I can get around this issue for when there's no javascript equivalent for the function I need to call, so I have to call a .NET funciton.
[1]:
[To see links please register here]
[2]:[3]:
[To see links please register here]