הפונקצייה מפצלת בין מחרוזות לפי המרווחים ,במחרוזת, במקומות בהן יש צורך לפצל:
void main () {
string line = "happy doggy";
string[] tokens = line.split (" ");
assert (tokens.length >= 2);
string col1 = tokens[0];
string col2 = tokens[1];
stdout.printf ("col1: %s, col2: %s\n", col1, col2);
}
string line = "happy doggy";
string[] tokens = line.split (" ");
assert (tokens.length >= 2);
string col1 = tokens[0];
string col2 = tokens[1];
stdout.printf ("col1: %s, col2: %s\n", col1, col2);
}
אין תגובות:
הוסף רשומת תגובה