Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract function return value

Status
Not open for further replies.

stekicar

Industrial
Joined
Jul 25, 2006
Messages
20
Location
US
What value extract function returns as in this example?
string_val = abcdef
ret_val=extract(string_val,1,7)

As you can see, extract function should give 7 strings long word but parameter is actually 6 strings long. Is it possible that extract func. returns NULL value?

How can I detect with IF statement the NULL value of ret_val parameter.
Something like this:

if (ret_val==NULL)
DO_THIS */ex.
else
DO_THAT */ex.
endif
 
Check for the length of string_val before obtaining ret_string.
If the length of sring_value is greater than 7, get the first seven characters.
If the length is 7 or less, use string_value as it is.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
I wanted to check if variable returns NULL as a value so I do not have to do length check. Thank you.
 
string_val = 'abcdef'
ret_val=extract(string_val,1,7)

if (ret_val=='')
result = 'NULL value'
else
result = 'value'
endif

If the length of string_val is less than the extract length, ret_val will be blank.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top