Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test whether a value is a string in Coldfusion

Tags:

coldfusion

I have a struct that I check for the existence of a key. I then need to test whether the value for that key is a string. I didn't spot anything in the Adobe CF docs like an isString() function (similar to isNumeric()).

Is there a good way other than using the seemingly broader isSimpleValue()?

like image 230
jinglesthula Avatar asked May 19 '16 20:05

jinglesthula


People also ask

How do you check variable type in ColdFusion?

You can see the current (JVM) type of a variable by doing <cfdump var=#getMetadata(var)# /> or simply by accessing getMetadata(var). getName() .

How do you split a string in ColdFusion?

ColdFusion treats each character in the delimiters parameter as a separate delimiter. Therefore, if the parameter is ",+" ColdFusion will break the list at either a comma or a plus sign. If you specify a multiCharacterDelimiter parameter, all list elements must be separated by exactly the specified characters.

How do you concatenate strings in ColdFusion?

ColdFusion already supports string concatenation using “&” operator. ColdFusion 8 introduces a new string operator “&=” for compound concatenation.

Is defined CF?

Cystic fibrosis (CF) is an inherited disorder that causes severe damage to the lungs, digestive system and other organs in the body. Cystic fibrosis affects the cells that produce mucus, sweat and digestive juices. These secreted fluids are normally thin and slippery.


1 Answers

The good way will depend on your context. ColdFusion does not use explicit types for variables.

'123456' can be a string and '2016-05-18 13:08:00' can be a string too, you have a good question but testing the value depends on what you're trying to do and what happens next with it.

like image 110
Alex Baban Avatar answered Oct 08 '22 06:10

Alex Baban