• Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting string to date with extra strings  RSS feed

 
rohit sen
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Here is my code. Is there a better way to do this without using the string replace function? I can use regex to replace all alphabets with spaces but wanted to know if I can somehow specify the characters to ignore when converting the string to date.




Thanks in advance
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use single quotes to include literal characters / Strings:
I'm not sure you should ignore the Z though, that has meaning.
 
rohit sen
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works. Thanks for the quick reply!
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!