Skip to content

Commit 71f0af8

Browse files
author
SlavaRa
committed
Replace 'string_value == null || string_value.Length == 0' by 'string.isNullOrEmpty(string_value)'
1 parent af853be commit 71f0af8

File tree

14 files changed

+19
-19
lines changed

14 files changed

+19
-19
lines changed

External/Plugins/AS2Context/Context.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ public override bool BuildCMD(bool failSilently)
13721372
{
13731373
command = Regex.Replace(command, "[\\r\\n]\\s*\\*", "", RegexOptions.Singleline);
13741374
command = " " + MainForm.ProcessArgString(command) + " ";
1375-
if (command == null || command.Length == 0)
1375+
if (string.IsNullOrEmpty(command))
13761376
{
13771377
if (!failSilently)
13781378
throw new Exception(TextHelper.GetString("Info.InvalidQuickBuildCommand"));

External/Plugins/ASCompletion/Completion/ASComplete.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ static public Hashtable ResolveElement(ScintillaControl Sci, string eventAction)
886886
if (eventAction == "ShowDocumentation")
887887
{
888888
string cmd = ASContext.Context.Settings.DocumentationCommandLine;
889-
if (cmd == null || cmd.Length == 0) return null;
889+
if (string.IsNullOrEmpty(cmd)) return null;
890890
// top-level vars should be searched only if the command includes member information
891891
if (CurrentResolvedContext.Result.InClass == ClassModel.VoidClass && cmd.IndexOf("$(Itm") < 0)
892892
return null;
@@ -1496,7 +1496,7 @@ private static bool ResolveFunction(ScintillaControl Sci, int position, bool aut
14961496

14971497
// get expression at cursor position
14981498
ASExpr expr = GetExpression(Sci, position, true);
1499-
if (expr.Value == null || expr.Value.Length == 0
1499+
if (string.IsNullOrEmpty(expr.Value)
15001500
|| (expr.WordBefore == "function" && expr.Separator == ' '))
15011501
return false;
15021502

External/Plugins/ASCompletion/Completion/ASGenerator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,7 @@ public static void GenerateExtractMethod(ScintillaControl Sci, string NewName)
27522752
IASContext context = ASContext.Context;
27532753

27542754
string selection = Sci.SelText;
2755-
if (selection == null || selection.Length == 0)
2755+
if (string.IsNullOrEmpty(selection))
27562756
{
27572757
return;
27582758
}
@@ -4166,7 +4166,7 @@ private static void GetStartPos(string currentText, ref int startPos, string key
41664166

41674167
private static string GetShortType(string type)
41684168
{
4169-
if (type == null || type.Length == 0)
4169+
if (string.IsNullOrEmpty(type))
41704170
{
41714171
return type;
41724172
}
@@ -4186,7 +4186,7 @@ private static string FormatType(string type)
41864186

41874187
private static string CleanType(string type)
41884188
{
4189-
if (type == null || type.Length == 0)
4189+
if (string.IsNullOrEmpty(type))
41904190
{
41914191
return type;
41924192
}
@@ -4214,7 +4214,7 @@ private static string GetSuperCall(MemberModel member, List<string> typesUsed, C
42144214
addTypeOnce(typesUsed, getQualifiedType(param.Type, aType));
42154215
}
42164216

4217-
bool noRet = member.Type == null || member.Type.Length == 0 || member.Type.Equals("void", StringComparison.OrdinalIgnoreCase);
4217+
bool noRet = string.IsNullOrEmpty(member.Type) || member.Type.Equals("void", StringComparison.OrdinalIgnoreCase);
42184218
if (!noRet) addTypeOnce(typesUsed, getQualifiedType(member.Type, aType));
42194219

42204220
string action = "";
@@ -4257,7 +4257,7 @@ private static int AddImportsByName(List<string> typesUsed, int atLine)
42574257
foreach (string type in typesUsed)
42584258
{
42594259
cleanType = CleanType(type);
4260-
if (cleanType == null || cleanType.Length == 0 || cleanType.IndexOf('.') <= 0 || addedTypes.Contains(cleanType))
4260+
if (string.IsNullOrEmpty(cleanType) || cleanType.IndexOf('.') <= 0 || addedTypes.Contains(cleanType))
42614261
continue;
42624262
addedTypes.Add(cleanType);
42634263
MemberModel import = new MemberModel(cleanType.Substring(cleanType.LastIndexOf('.') + 1), cleanType, FlagType.Import, Visibility.Public);

External/Plugins/ASCompletion/Model/ASFileParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private static string getRandomStringRepl()
201201
/// </summary>
202202
private static MemberModel extractTypedCallbackModel(string comment)
203203
{
204-
if (comment == null || comment.Length == 0)
204+
if (string.IsNullOrEmpty(comment))
205205
return null;
206206

207207
int idxBraceOp = comment.IndexOf("(");

External/Plugins/ASCompletion/Model/MemberModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static public string FormatType(string type)
224224
}
225225
static public string FormatType(string type, bool allowBBCode)
226226
{
227-
if (type == null || type.Length == 0)
227+
if (string.IsNullOrEmpty(type))
228228
return null;
229229
int p = type.IndexOf('@');
230230
if (p > 0)

External/Plugins/CodeRefactor/Commands/SurroundWithCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected void ExecutionImplementation()
3535
IASContext context = ASContext.Context;
3636

3737
string selection = sci.SelText;
38-
if (selection == null || selection.Length == 0)
38+
if (string.IsNullOrEmpty(selection))
3939
{
4040
return;
4141
}

External/Plugins/FileExplorer/PluginUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ private void FileViewAfterLabelEdit(Object sender, System.Windows.Forms.LabelEdi
717717
ListViewItem item = null;
718718
try
719719
{
720-
if (e.CancelEdit || (e.Label == null) || (e.Label.Length == 0) || (e.Label == this.previousItemLabel))
720+
if (e.CancelEdit || string.IsNullOrEmpty(e.Label) || e.Label == this.previousItemLabel)
721721
{
722722
e.CancelEdit = true;
723723
return;

External/Plugins/HaXeContext/Context.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ public override bool BuildCMD(bool failSilently)
15841584
{
15851585
command = Regex.Replace(command, "[\\r\\n]\\s*\\*", "", RegexOptions.Singleline);
15861586
command = " " + MainForm.ProcessArgString(command) + " ";
1587-
if (command == null || command.Length == 0)
1587+
if (string.IsNullOrEmpty(command))
15881588
{
15891589
if (!failSilently)
15901590
throw new Exception(TextHelper.GetString("Info.InvalidQuickBuildCommand"));

External/Plugins/ProjectManager/Projects/AS3/FlexProjectReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private void ReadBuildTargets()
301301

302302
public static String ResolvePath(String path, String relativeTo)
303303
{
304-
if (path == null || path.Length == 0) return null;
304+
if (string.IsNullOrEmpty(path)) return null;
305305
Boolean isPathNetworked = path.StartsWith("\\\\") || path.StartsWith("//");
306306
if (Path.IsPathRooted(path) || isPathNetworked) return path;
307307
String resolvedPath = Path.Combine(relativeTo, path);

FlashDevelop/Managers/ImageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private static void ProcessImageData(String data)
9494
{
9595
X = Y = 0;
9696
Icon = Bullet = -1;
97-
if (data == null || data.Length == 0) return;
97+
if (string.IsNullOrEmpty(data)) return;
9898
String[] par = data.Split('|');
9999
if (par.Length > 0)
100100
{

0 commit comments

Comments
 (0)