File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test string for hellip

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the easiest way to test that last character in string is a hellip […]?

Writing a unit test with Selenium and JUnit and I was expecting it to return "cancer resear…", but it is returning "cancer resear…"

Hopefully I can figure this out before someone posts an answer

Thanks,
Eric

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the unicode for that character is 0x2026, so something like

if (theString.charAt(theString.length()-1) == '\u2026') ...
 
Kevin Workman
Ranch Hand
Posts: 151
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a stupid question- Can't you just use lastIndexOf("...")?

Edit- Nevermind! Stupid question answered.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ' is what was my issue.

Been awhile since I have done Java and forgot ' for Character.

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iman khan,
Your post was moved to a new topic.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic