I’m looking to find a way to convert a string to an int in order to then extract and return the first 4 digits in this int.
Note: It must remain as a String for the other methods to work properly, though.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try following:
Wherever you want integer for first four character use
intForFirst4Charand where you wanna use string use appropriate.Hope this helps.