使用分隔符解析一个字符串到TStringList,似乎也解析空格(Delphi) [英] Parsing a string using a delimiter to a TStringList, seems to also parse on spaces (Delphi)
本文介绍了使用分隔符解析一个字符串到TStringList,似乎也解析空格(Delphi)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题是当我看看输出,它还包括空格作为分隔符,并排除我的结果。如何避免这种情况,或者有更好的方法来做到这一点。
解决方案
在TStringList中有一个StrictDelimiter属性。将其设置为True,它只会在分隔符上分析,而不是空格。
I have a simple string which is delimited by some character, let's say a comma. I should be able to create a TStringList and set it's delimiter to a comma then set the DelimitedText to the text I want to parse and it should be automaticlly parsed.
The problem is when I look at the output it also includes spaces as delimiters and chops up my results. How can I avoid this, or is there a better way to do this.
解决方案
There's a StrictDelimiter property on the TStringList. Set it to True and it will only parse on the delimiter, not the spaces.
这篇关于使用分隔符解析一个字符串到TStringList,似乎也解析空格(Delphi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文