java - String Manipulation -


This form is XxYxZx in my string

are X, Y and Z characters and are X numbers Can be different from 0-999.

I want to split this string into this form. How can this be done?

  • Xx
  • Yx
  • Zx

    Example:

     < Code> string myString = "A155B45C77D89"; String [] parts = myString.split ("(? & Lt; = \\ d) (? = \\ p {alpha})"); Println (Arrays.toString (parts));   

    Output:

      [A155, B45, C77, D89]   

    Explanation:

    String.split works with regular expressions. Regular expression (? & Lt; = \ d) (? = \ P {alpha}) says, "matches all the substrings moving forward one digit, succeeded by an alphabet character < In the string such as / em>

    "A155B45C77D89" , this expression corresponds to empty substrings

      A155 B45 C77's D89 ^ ^ ^ here | | here | | and here    

  • Comments

    Popular posts from this blog

    mysql - BLOB/TEXT column 'value' used in key specification without a key length -

    c# - Using Vici cool Storage with monodroid -

    python - referencing a variable in another function? -