lamuria Posted October 21, 2009 at 09:21 PM Report Share #292799 Posted October 21, 2009 at 09:21 PM boas programo ha muito pouco tempo, e gostava de saber se há alguma maneira de fazer operações matemáticas com strings. tanto operações básicas como somas, multiplicações etc etc como mais complexas do tipo logaritmos, expoentes etc etc (nestes últimos posso utilizar a classe math? ou a class math não funciona com strings?) obrigado pelas respostas Link to comment Share on other sites More sharing options...
bruno1234 Posted October 21, 2009 at 09:33 PM Report Share #292801 Posted October 21, 2009 at 09:33 PM Operações matemáticas com strings? As strings são texto. Não dá para fazer operações matemáticas. O q podes é transformar strings q contenham valores numericos no tipo respectivo e aí sim fazer as contas. Ex: String a = "10"; String b = "10"; int x = Integer.ParseInt(a); int y = Integer.ParseInt(b); int res = x + y; Matraquilhos para Android. Gratuito na Play Store. https://play.google.com/store/apps/details?id=pt.bca.matraquilhos Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now