Advertisement
hyungu

Table startsWith endsWith Exercises

Mar 31st, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Write code to print all the rows where the name starts with "X".
  2.  
  3. table = new SimpleTable("baby-2010.csv");
  4. for (row: table) {
  5. if (row.getField("name").startsWith("X")) {
  6. print(row);
  7. }
  8.  
  9. }
  10.  
  11. ---------------------------------------------------
  12. Write code to print all the rows where the name starts with "Xz".
  13.  
  14. table = new SimpleTable("baby-2010.csv");
  15. for (row: table) {
  16. if(row.getField("name").startsWith("Xz")) {
  17. print(row);
  18. }
  19.  
  20. }
  21.  
  22. ---------------------------------------------------
  23.  
  24. Write code to print all the rows where the name ends with "x".
  25.  
  26. table = new SimpleTable("baby-2010.csv");
  27. for (row: table) {
  28. if(row.getField("name").endsWith("x")) {
  29. print(row);
  30.  
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement