The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Help: Convert string to int
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hotelbravo

Austria
Posts

Posted - 12/28/2007 :  1:24:27 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everybody,

can somebody please help me with following problem:

I just want to convert a string, which contains some numbers, to an integer or double.

I'm afraid, but I do not know how to manage this. I've already searched in the help and in this forum, but results were negative...


Thanks to all who help me!

cpyang

USA
1406 Posts

Posted - 12/28/2007 :  2:41:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I assume you are talking about Origin C?

atoi to convert to int
atof to convert to double

CP


Go to Top of Page

hotelbravo

Austria
Posts

Posted - 01/02/2008 :  12:52:13 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
oh sorry, I am programming in Labtalk, not in Origin C. Is therefore any command to convert a string to int or double?

for example: string a = 100 should be convert to integer
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 01/02/2008 :  1:59:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
LabTalk assignment will directly convert literal string into value. So basically it is a matter of how to convert a LT string variable into a literal, which can be done by the %( ) substitution, see below:




string a$=100;int b=%(a$);b=;






CP

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000