Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

case & string

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

case & string

sometimes i need to use case statement with a string

 
  pointer st = Ziron_GetStringValue();
  case (st) {

          state 'mystring':
                 ........
                 ........
                 brack; 
 

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I may consider adding this, but not in any upcoming releases because i first need to finish optimizing other routines and finish adding the rest of the feature set, this feature is more of a high level helper (which will be good for simple tasks)

btw, it would be much better/faster to check manually something like:

//input
str = 'mystring';

//code
eax = str;
case (char[eax]) {
  state "m":
    if (char*[eax] == "myst" and char*[eax+4] == "ring") {
      //
    }
    break;

  state ....
}

I will hopefully add case on base expressions in an upcoming beta.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

nice work around .

http://www.freewebs.com/ogremagic/index.htm