473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can I check if the string variable is empty?

How can i check if the string variable is empty?
so that i the error undefined offset will not going to appear anymore?

im doing a program that will output all of his children, then i cant do the code that if the string variable is empty they will not out put the row, if the string variable has something on it, it will out put the information and also add another row..

thanks

sorry for this kind of question
i just need help

thanks
Sep 3 '10 #1
2 3134
kovik
1,044 Expert 1GB
As Markus suggested, empty() will do what you need.

empty() is a combination of isset() and a check against the value. For strings, it checks that the value is not ''. For integers, it checks if the value is not 0. For booleans, it checks if the value is not false. For arrays, it checks if there are any indices.

This is done on a very low level (empty is actually a language construct, like include) so the check is faster than doing it yourself.
Sep 3 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: sinister | last post by:
Is there a PHP function to verify that a string validly represents an integer?
4
by: Bosconian | last post by:
I've been researching this for hours and can't seem to find the right syntax. I need to retrieve a value of an array by referencing the element using a string variable. For example: $data...
4
by: Hamed | last post by:
Hello How can I check if a string is empty? Thanks
5
by: Shapper | last post by:
Hello, I am using this code line to check i a variable exists: If cookie Is Nothing Then .... How can I check if cookie is empty when cookie exists? Thanks, Miguel
3
by: Jim in Arizona | last post by:
Is there an easy way to just get a single value from a database and put it into a string? This is as far as I can get: Dim TKEY As String TKEY = dlShowRequests.DataKeys(e.Item.ItemIndex) ...
2
by: shapper | last post by:
Hello, I need to check if a string is empty. Should I use: String.IsNullOrEmpty(MyString) or MyString Is Nothing? What is the difference?
31
by: noagbodjivictor | last post by:
How to check if a string is empty in python? if(s == "") ??
9
by: JohnR | last post by:
I have the name of a control in a string variable and I want to change one of the controls properties. Right now I recursively scan all the controls on the form until I get one whose name matches...
0
by: =?Utf-8?B?cm9uZSBtYXRpYXM=?= | last post by:
I have the same task to do but everytime I tried to parse my code I get a null value returned after executing "dtMaterials.WriteXml(swMaterials);". I am using the following code: Hope you can hep...
0
by: prao2005 | last post by:
how to check whether the value of a string variable is Yes or No? xsl;variable name="test1" select="DBE:OBJECT/DBE:ATTRIBUTE/DBE:String"/> xsl;variable name="test2"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.