I'm wondering if anyone can tell me what the following line of code would actually do. I'm not a PowerBuilder developer, but I'm trying to recreate a piece of software in a modern language, and just want to know what this line does exactly.
var_1 = ' ';
var_2 = ' ';
var_3 = ' ';
....
//some logic that might change var_1, var_2, or var_3
....
var_all = var_1 + var_2 + var_3
if trim(var_all) > " " and trim(var_all) > "" then //that's 4 spaces
//some logic
end if
I have a feeling this is checking length, but can't find out for sure what that > operator does with strings in PowerBuilder.
I think what is supposed to happen is if the total length of the var_all
string is greater than 4, do //some logic
, but I can't be sure.
In short: String operators <, >, and = do a case-sensitive alphabetical comparison of two strings based on your current regional settings.
EX: Regional settings = Danish sorting => 'AA' sorts after 'Z' ('AA' equivalent to 'Å')
Trim(var_all)
removes all leading and trailing spaces (but only ASCII space = ASCII value 0x20)... > ""
implements "any non-empty string"... > " "
implements "any string sorting after a space character"
In your context equivalent behaviour can be obtained in PowerScript as follows:
IF Trim(var_all) > " " THEN
...
END IF