473,796 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Casting Question - I think!! Help please

I have a string called jkl which currently is "3 * 4 + xyz"
I also have an integer: xyz = 5

How do get an integer that equals 17 (3 times 4 plus 5.)

In other, more specifically:

dim jkl as string = "3 * 4 + xyz"
dim xyz as integer = 5

dim answer as integer = ??????????????? ?????????

Thanks much in advance.

Nov 21 '05 #1
3 933

Dim jkl As String
Dim xyz As Integer = 5
Dim ans As Integer
ans = CInt(12 + xyz)

"Alex Pierson" wrote:
I have a string called jkl which currently is "3 * 4 + xyz"
I also have an integer: xyz = 5

How do get an integer that equals 17 (3 times 4 plus 5.)

In other, more specifically:

dim jkl as string = "3 * 4 + xyz"
dim xyz as integer = 5

dim answer as integer = ??????????????? ?????????

Thanks much in advance.

Nov 21 '05 #2
Alex Pierson schrieb:
I have a string called jkl which currently is "3 * 4 + xyz"
I also have an integer: xyz = 5

How do get an integer that equals 17 (3 times 4 plus 5.)

In other, more specifically:

dim jkl as string = "3 * 4 + xyz"
dim xyz as integer = 5

dim answer as integer = ??????????????? ?????????

Thanks much in advance.

You must use a compiler to compile this code.

http://msdn.microsoft.com/library/en...elanguages.asp
Armin
Nov 21 '05 #3
I saw a mathematical expression parser over at CodeProject the other day
that could handle this and a lot more...

"Alex Pierson" <ar******@chart er.net> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I have a string called jkl which currently is "3 * 4 + xyz"
I also have an integer: xyz = 5

How do get an integer that equals 17 (3 times 4 plus 5.)

In other, more specifically:

dim jkl as string = "3 * 4 + xyz"
dim xyz as integer = 5

dim answer as integer = ??????????????? ?????????

Thanks much in advance.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1421
by: Al Tobey | last post by:
DBIx::Config is a new module I've written to simplify connecting to databases and passing the resulting handles between packages. Before uploading to CPAN, I'd like to see what people around here think. Please comment in either a followup here or in an email to tobeya at cpan dot org http://www.tobert.org/tmp/Config.html http://www.tobert.org/tmp/Config.pm Of course, I have a few test written that will be bundled with this that
1
1180
by: KK | last post by:
Hi All i have an interface like this in file Interface.h __gc __interface IParam { }; My implementation class is like this public __gc class Param : IParam {
35
2709
by: ytrama | last post by:
Hi, I have read in one of old posting that don't cast of pointer which is returned by the malloc. I would like to know the reason. Thanks in advance, YTR
44
2244
by: Agoston Bejo | last post by:
What happens exactly when I do the following: struct A { int i; string j; A() {} }; void f(A& a) { cout << a.i << endl;
1
281
by: Remco | last post by:
Hi, Let me try to simply explain my questions. I've created a portal site with different types of users, e.g. Portal Administrators and Normal Users. One base class SessionUser (has a enum field UserType) and for each type of user a inherited class like SessionMasterUser and SessionNormalUser.
12
13653
by: 6tc1 | last post by:
Hi all, I just discovered a rounding error that occurs in C#. I'm sure this is an old issue, but it is new to me and resulted in a fair amount of time trying to track down the issue. Basically put the following code into your C# app: float testFloat2 = (int) (4.2f * (float)100); Console.Out.WriteLine("1: "+testFloat2); and the result will be 419
7
13714
by: S. Lorétan | last post by:
Hi guys, Sorry for this stupid question, but I don't know why it isn't working. Here is my (example) code: namespace Test { class A { public string Label1; }
7
2654
by: William S Fulton | last post by:
I'm looking for the name of the following casting style in order to do some reading around on it and why it is sometimes used. unsigned long long ull = 0; void * ptr = 0; ull = *(unsigned long long*)&ptr; As opposed to the more usual casting:
4
3044
by: Wally Barnes | last post by:
Can someone help a poor C++ programmer that learned the language before there was a standard lib .. etc ? Basically I have two classes that look something like below: template <class T> class ListLogic { public: struct LogicBase {
0
9679
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.