れい #4695(2007/12/09 07:23 GMT) [ VB.net ] Rating0/0=0.00
適当。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Module Module1 Sub Main() Dim input As String = _ "A B C D E" & ControlChars.CrLf & _ "| | |-| |" & ControlChars.CrLf & _ "|-| | |-|" & ControlChars.CrLf & _ "| |-| |-|" & ControlChars.CrLf & _ "|-| |-| |" & ControlChars.CrLf & _ "|-| | | |" Console.WriteLine(input) Console.WriteLine(GhostLeg(input)) Console.ReadKey() End Sub Public Function GhostLeg(ByVal input As String) As String Dim inputlines As String() = input.Split(New String() {ControlChars.CrLf}, StringSplitOptions.RemoveEmptyEntries) Dim lines As String() = inputlines(0).Split(Nothing) For i As Integer = 1 To inputlines.Length - 1 Dim bars As String() = inputlines(i).Split(New Char() {"|"c}) For j As Integer = 1 To bars.Length - 2 If bars(j) <> " " Then Dim s As String = lines(j) : lines(j) = lines(j - 1) : lines(j - 1) = s Next Next Return String.Join(" "c, lines) End Function End Module
Rating0/0=0.00-0+
[ reply ]
れい #4695() [ VB.net ] Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]