Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

String Processing question in java

I need to have the results of the processed string properly quoted. The following are my attempts and results.

code:
        command.createArgument().setValue("{" + formatSVNDate(lastBuild) + "}" + ":"
                + "{" + formatSVNDate(checkTime) + "}");
Result:
svn log --non-interactive --xml -v -r {2006-05-19T14:30:19Z}:{2006-05-20T13:42:13Z}"

code:
        command.createArgument().setValue("'{" + formatSVNDate(lastBuild) + "}'" + ":"
                + "'{" + formatSVNDate(checkTime) + "}'");
Result:
svn log --non-interactive --xml -v -r '"{2006-05-19T14:30:19Z}":"{2006-05-20T13:42:13Z}"'

What  Ineed genereated:
svn log --non-interactive --xml -v -r '{2006-05-19T14:30:19Z}':'{2006-05-20T13:42:13Z}'
OR
svn log --non-interactive --xml -v -r "{2006-05-19T14:30:19Z}":"{2006-05-20T13:42:13Z}"

0
MichaelAllen
Asked:
MichaelAllen
1 Solution
 
basicinstinctCommented:
command.createArgument().setValue("'{" + formatSVNDate(lastBuild) + "}':'{" + formatSVNDate(checkTime) + "}'");
0
 
basicinstinctCommented:
Sorry

command.createArgument().setValue("\'{" + formatSVNDate(lastBuild) + "}\':\'{" + formatSVNDate(checkTime) + "}\'");
0
 
basicinstinctCommented:
probably eaither will work - i'm confusing myself now
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MichaelAllenAuthor Commented:
I just tried your suggestion but no luck, I got the same results using either of the formats you gave. It seems like the entire string is being quoted no matter what I pass in.
0
 
suprapto45Commented:
Hi,

command.createArgument().setValue("{" + formatSVNDate(lastBuild) + "}" + ":"
                + "{" + formatSVNDate(checkTime) + "}");

should be

command.createArgument().setValue("'{" + formatSVNDate(lastBuild) + "}'" + ":"
                + "'{" + formatSVNDate(checkTime) + "}'");

or


command.createArgument().setValue("\"{" + formatSVNDate(lastBuild) + "}\"" + ":"
                + "\"{" + formatSVNDate(checkTime) + "}\"");
0
 
suprapto45Commented:
opp..

that is the same codes as what basicinstinct provided. Please let me know if you still encounter problem

David
0
 
Alejandro_CasagrandeCommented:
Hi, try this

code:
        command.createArgument().setValue("'"+"{"+"'"+ formatSVNDate(lastBuild) + "'"+"}"+"'"+  ":"
                + "'"+"{" +"'"+ formatSVNDate(checkTime) + "}"+"'");

Regards!
Alejandro
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now