aspose file tools*
The moose likes Beginning Java and the fly likes Test string for hellip Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Test string for hellip" Watch "Test string for hellip" New topic
Author

Test string for hellip

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

Well, the unicode for that character is 0x2026, so something like

if (theString.charAt(theString.length()-1) == '\u2026') ...


[Jess in Action][AskingGoodQuestions]
Kevin Workman
Ranch Hand

Joined: Sep 28, 2010
Posts: 151
I have a stupid question- Can't you just use lastIndexOf("...")?

Edit- Nevermind! Stupid question answered.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

iman khan,
Your post was moved to a new topic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test string for hellip