从字符分隔的字符串层次 [英] Hierarchy from char delimited string

查看:122
本文介绍了从字符分隔的字符串层次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在做我的问题了大量的研究,似乎无法拿出一个很好的解决方案。

I have been doing a lot of research on my problem and can't seem to come up with a good solution.

这个问题我有一个包含以下列表中。

the problem I have a list containing the following

a
a/b
a/b/c
a/b/c/d
a/b/f
a/1
a/2
t
t/1

我需要解析成可以处理父子层次结构中的类。明知任何级别可以有孩子的无限量。

I need to parse that into a class that can handle parent child hierarchy. Knowing that any level can have unlimited amount of children.

任何帮助将appriciated。

Any help would be appriciated.

推荐答案

您输入的格式几乎是相同的SQL Server中的层次结构节点路径字符串。有关分析这些下面的StackOverflow问题可能会非常接近,如果不是你想要什么。

The format of your input is almost identical to the node path strings in Sql Server hierarchies. The following StackOverflow question about parsing those will probably be very close to, if not exactly what you want.

<一个href=\"http://stackoverflow.com/questions/6945216/converting-flattened-hierarchical-data-from-sql-server-into-a-structured-json-ob\">Converting扁平从SQL Server分层数据变成结构化的JSON对象的C#/ LINQ的

这篇关于从字符分隔的字符串层次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆