HEEELP MEE

Hi, if anyone could help me. You see I am working in an app and I need to take the numeric quantity of the variable mensje and save it in another variable I've already tried with the split and I think I'm not doing it correctly, please help me this is the piece of code

     mensajitos.Add(new Informacion { mensaje = "Estimado usuario se ha efectuado un debito de Q800.00 por compra de papitas" });

Posts

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭
    I'd suggest a regex to get the numeric part and then use int.parse to convert to an int.
  • Gigex42Gigex42 USMember ✭✭✭✭
    edited April 25

    Like @JamesLavery said try using regex.

    With this site you can test your regex.

    If the quantity always starts with the Q try looking for it and look if there are numbers after it. 100% success rate but combined with the int.parse method it should work.

    And next time please take a better title instead of "HEEELP MEE"

Sign In or Register to comment.