Text - NKS0055
Use TextTools.SplitNewLines()
This analyzer provides the following strings:
Error List
Caller uses TextTools.SplitNewLinesOld()
instead of TextTools.SplitNewLines()
Suggestion Box
Use TextTools.SplitNewLines()
instead of TextTools.SplitNewLinesOld()
Description
TextTools.SplitNewLines()
is able to correctly split text with Mac OS 9 newline characters and mixed new line characters, while TextTools.SplitNewLinesOld()
can't split such strings properly.
Extended Description
This code analyzer detects the usage of SplitNewLinesOld()
from the TextTools
class found in the KS.Misc.Text
namespace.
While SplitNewLinesOld()
is here to split the new lines efficiently, there has been problems dealing with the mixed newline handling, especially when it comes to splitting text by the Mac OS 9 newline, which is a carriage return character \r
.
As a result, SplitNewLines()
has been rewritten to more efficiently handle these situations.
Analysis Comparison
To get a brief insight about how this analyzer works, compare the two code blocks shown to you below:
Before the fix
After the fix
After the fix (alternate)
Suppression
You can suppress this suggestion by including it in the appropriate place, whichever is convenient.
For more information about how to suppress any warning issued by the Nitrocid analyzer, visit the below page:
Recommendation
We recommend that every caller which use this function use the recommended abovementioned method.