Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. System.out.println("Cart count is:-" +Cartcount.getText());
  2. /*String s1="(0)";
  3. String replaceString=s1.replace('(',' ');
  4. String replaceString1=s1.replace(')',' ');
  5. //replaces all occurrences of 'a' to 'e'
  6. System.out.println(replaceString);
  7. System.out.println(replaceString1); */
  8. String str = "(0)";
  9. System.out.println("Split");
  10. String[] arr = str.split("(0)",2);
  11. for (String w : arr) {
  12. System.out.println(w);
  13. }
  14. // System.out.println("Split array length: "+arr.length);
  15. /* String Cartcount=driver.findElement(By.id("cart_item_count")).getText();
  16. System.out.println(Cartcount);
  17. String tem[]=Cartcount.split(" ");
  18. System.out.println(tem[2]);
  19. String temp[]=tem[2].split("\(");
  20. System.out.println(temp[1]);*/
  21.  
  22. if (Cartcount.equals(0)) {
  23. System.out.println("Cart is empty") ;
  24. }
  25. else
  26. {
  27. System.out.printf("Cart is not empty");
  28. }
  29. Output-
  30. Cart count is:-(0)
  31. Split
  32. (
  33. )
  34. Cart is not empty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement