-7

If in java filed value is coming like 1123456@lopoa format. So My question I am trying to take the value before @.

So according to java what to do to implement this logic?

Achaks
  • 3
  • 4

1 Answers1

0

You should use split(String) method of String class.

Following is working code:

public static void main (String[] args)
{
    String val = "1123456@lopoa";
    String[] vals = val.split("@");
    System.out.println(vals[0]);
}

Output:

1123456

See it working here

cse
  • 4,066
  • 2
  • 20
  • 37