I would expect the following Java code to split a string into three items:
String csv = "1,2,";
String[] tokens = csv.split(",");
System.out.println(tokens.length);
def test_split(self):
line = '1,2,'
tokens = line.split(",")
for token in tokens:
print('-' + token)
-1
-2
-
[Test]
public void t()
{
string s = "1,2,";
var tokens = s.Split(',');
foreach (var token in tokens)
{
Console.WriteLine("-" + token);
}
}
-1
-2
-