Hi All...
Plz solve my problem.

String temp="Vendor number modified from 12345 to 00056789"

How to separate these two numbers ?

Plz reply soon.

Recommended Answers

All 6 Replies

This is easily done with the java.util.regex package.

String temp="Vendor number modified from 12345 to 00056789";
Pattern pattern = Pattern.compile("Vendor number modified from (\\d+) to (\\d+)");
Matcher matcher = pattern.matcher(temp);
if (matcher.matches()){
    String fromNumber = matcher.group(1);
    String toNumber = matcher.group(2);
    System.out.println("from: "+fromNumber);
    System.out.println("to: "+toNumber);
}

But it's showing Pattern & Matcher unresolved & util.regex package not found.

Have you imported java.util.regex.Pattern for Pattern and java.util.regex.Matcher for Matcher or at least imported java.util.regex.*? Defenetly not...

Hi...

By using java.util.regex.* or java.util.regex package an error msg as symbol can't be resolved is coming.I think it's not supported in WSAD 5.1.What might be the reason ?

Hi...

By using java.util.regex.* or java.util.regex package an error msg as symbol can't be resolved is coming.I think it's not supported in WSAD 5.1.What might be the reason ?

From my searching, it looks like 5.1 uses java 1.3 by default, you need to switch this to java 1.4. This thread has some info:
http://www.webservertalk.com/message902279.html

Your development tool is 4 years out of date and you really should look into a more recent version.

Thnx very much Sir....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.