Spartan
Spartan

Reputation: 3401

Store Backward slash and forward slash in java string

I am parsing below string value into OData query through java code.

objects.put("EndDate", "\/Date(1441756800)\/";

How can i parse the /Date(1441756800)/ into a string in java.

I have tried with below :

objects.put("EndDate", ""\\""//"Date(1441756800)""\\""//"";

throws error:(

Upvotes: 0

Views: 4950

Answers (2)

Pshemo
Pshemo

Reputation: 124275

I never used OData so I may not understand your question correctly, but if you are asking how to write \/Date(1441756800)\/ as String then you need to escape \ as it is String special character (used for instance when escaping or when creating other special characters like line separators \n).

So try with "\\/Date(1441756800)\\/"

Upvotes: 1

Vaibhav Shah
Vaibhav Shah

Reputation: 528

Try this - objects.put("EndDate", "'Date(1441756800)'";

Upvotes: 1

Related Questions