Tuesday, May 21, 2019

How to convert string to number in ionic

How to convert string to number in ionic

There are a lot of you are having a problem to convert data types are difficult to solve in the ionic programming situations, because this very language is new, here I will detail instructions for the user to know how to convert data ionic types to string data type integer.

In programming languages such as java, php, c, c++, ... all can move data easily, then in ionic can also create for us data conversion is also an easy way not least in other programming languages.

How to convert string to number in ionic

Here I will do another example of Convert string to number you can consult, if what his comment questions will answer, if in the process built a demo what flaws people looking forward to their feedback can improve more than.

E.g. I have a variable private mPosition: number, present yourself save variables into the phone's memory in the form like this:
localStorage. setItem ("position", "" + this. mPosition);
I will convert the data type string to type int will do the following:
this.mPosition = parseInt this. (localStorage. getItem ("the position"))

2 comments:

  1. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. More information

    ReplyDelete