• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

Is there a way to tell if a character in a string is a supset or subset?

Is there a way to tell if a character in a string is a supset or subset?
0
NevSoFly
Asked:
NevSoFly
  • 2
1 Solution
 
käµfm³d 👽Commented:
Please elaborate.
0
 
NevSoFlyAuthor Commented:
My apologies I was using the wrong terminology.  I am trying to identify different parts of the expression  2x + 4y2. namely the 4y2 section, where the 2 at the end of the expression is an exponent (superscript).  It is possible that the 2 could also be a subscript in a different expression.

This part of the expression is displayed in a rich textbox and each character in it is assigned to an element in a string array using string.split().   I am attempting to writing a function to identify the different elements in the array (coefficient, variable and operator).  

I have identified everything except for the 2 and do not know how to proceed.

thanks for your time.
0
 
CodeCruiserCommented:
I think you can check for the previous token and if that is a character (y in this case) then assume it to be exponent.
0
 
NevSoFlyAuthor Commented:
yes that would work but only if the previous token was a variable.  but this answer is the closest I found.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now