Search code examples
c#vbscriptcode-conversion

how does vbscript evaluate string greater than string?


i'm converting some vbscript from an asp app and ran across a line in the form of

If sCode > "" Then

where I expect sCode to contain a string. i know enough vbscript to plod through it but i'm not sure of the behavior of some quirkier statements. c# will not accept that as a valid condition check. what is an equivalent c# statement?

edit: extra thanks if someone can provide some documentation/reference for the vbscript behavior.


Solution

  • Since in C# a string can also be NULL, I would use the following:

    if(!string.IsNullOrEmpty(sCode))
        //do something