టెక్స్ట్ ఖాళీగా ఉందో చూడటం
ఖాళీ స్ట్రింగ్లో అక్షరాలు ఉండవు. ఒక స్థలం ఇప్పటికీ ఒక పాత్ర.
String.IsNullOrEmpty
ఒక చిన్న ఉదాహరణ
అక్షరాలు లేని స్ట్రింగ్ ఖాళీగా ఉందా?
మొదట''
ఫలితంTrue
using System;
Console.WriteLine(string.IsNullOrEmpty(""));
True
ప్రకటనలు
రోజువారీ ఉదాహరణలు
లైబ్రరీ కార్డులో పేరు నమోదు చేయబడలేదు. ఫారం ఒకటి అడగాలా?
మొదట''
ఫలితంTrue
using System;
Console.WriteLine(string.IsNullOrEmpty(""));
True
ఒక ప్రయాణికుడు సీట్ ఫీల్డ్ లో ఒక స్థలాన్ని టైప్ చేశాడు. ముడి ఫీల్డ్ ఖాళీగా ఉందా?
మొదట' '
ఫలితంFalse
using System;
Console.WriteLine(string.IsNullOrEmpty(" "));
False
తరగతి గది తెర సిద్ధంగా ఉంది అని చెబుతుంది. సందేశం ఖాళీగా ఉందా?
మొదట'Ready'
ఫలితంFalse
using System;
Console.WriteLine(string.IsNullOrEmpty("Ready"));
False
ఉదాహరణను రన్ చేయండి
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson